Share this post on:

Here we will discuss Input / Output function in C language. C provides two common function for Input / Output.

  • Scanner
  • Printer

Scanner : This function us used to input values to the keyboard at a runtime.

Syntax : Scanf(“Control string “, &variable);

control string indicates the format of value inputted to the keyboard also called format specifiers.

Following are common formal Specifier used in C:

%d —> int

%s —> string

%f —> float

%h —> short int

%c —> char

%u —> unsigned int /address

Example : int a;

scanf(“%d”,&a);

printf : This function is used to print the value variable in the string.

Example: printf(“Hellow world”);

Question : Write a Program to input tow number and find the sum in C ?

#include <stdio.h>

#include <conio.h>

main()

{

int a,b,c;

printf(“Enter two no”);

scanf(“%d%d, &a,&b);

c=a+b;

printf(“sum=%d”,c);

}

Question : write a program to input the employee salary and calculate 40% bonus?

#include <stdio.h>

#include <conio.h>

main()

{

int ES,BS,NS;

printf(“Enter employe salary”)

scanf(“%d,&ES);

BS=(40*ES)/100;

NS=ES+BS;

printf(“%d”,BS);

printf(“%d”,NS);

}

Share this post on:
Avatar Raiyan

Author: Raiyan

Hi, I guess you're here because you want to know a bit about me. huh? I am not so good on talking about myself but I'll give a short about me.

My Name is Raiyan. I am a Professional Application Developer and a Blogger.
I started this website to Share my Knowledge. Here I provide all my knowledge whatever I earned till now.

Leave a Comment

Your email address will not be published. Required fields are marked *