Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Tuesday, March 10, 2015

What is scanf() ?

It is an input function which is used to input the data from the keyboard or any input device. It is also an input formatted function.
The scanf() function has two parts one is the format specifier and another is variable with address operator.
Syntax:
     scanf(“format specifier”, &variable);
Ex:
     scanf(“%d”,&value);
Program: Read two values from the keyboard.
#include<stdio.h>
#include<conio.h>
void main()
{
     int x, y;
     printf(“Enter Two Values :”);
     scanf(“%d%d”,&x,&y);
     printf(“x = %d \n y = %d”,x,y);
     getch();
}
Output:
Enter Two Values: 10 20
x = 10

y = 20 

No comments:

Post a Comment