Input/Output operations are the operation used to take input from user and to display output on monitor by program.This whole process can be referred as Input/Output Management.Mainly stdlib is the standard library file for input/output operations.For accepting input from user standard input i.e stdin data stream is used and for output it is stdout.Hence as we learn from previous post for input/output functionality in program ,stdio.h has to be include.
Mainly to print output we use printf function and to accept input we use scanf function.
Syntax of both functions are as follow;
#include<stdio.h>
void main()
(
int a;
printf(" Enter an integer number");
scanf("%d",& a);
printf("Your entered integer is %d",a);
}
as we see % d is use to accept decimal integer number ,like this there are more controls to accept different value i.e
- %c - a single character
- %i - an integer
- %s -a string
- %e,%f,%g - used for floating point
- %o - an octal number
- %x -a hexadecimal number
- %p - a pointer
- %u - an unsigned integer
- %lf - as double floating pt
- %Lf - as long double floating pt
No comments:
Post a Comment