It is a function and is used to read data from the standard input device (Key Board).
Syntax:
int scanf("format(s)",address-1, address-2,..............., address-n);
Eg:
int n;
// address of n=&n
scanf("%d", &n);
from the above scanf statement is used to take the input from the keyboard on the output console. Address(&) of n indicates as &n.
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("Enter any Number :");
scanf("%d", &n);
printf("Given Number is : %d", n);
getch();
}
Output:
Enter any Number : 10
Given Number is : 10
No comments:
Post a Comment