input
The process of providing something to the computer is called an input. Program need many certain from the user for working property and Input is mostly given by keyboard. C programing language provides many built in functions to read many given input to computer.
Some important function for input are:
- Scanf()
Syntax
scanf(format string, &variable 1, &variable 2, &variable 3 ...)
The variables are used to store the value entered by the user through keyboard.
For Example :
scanf("%d %f", &n, &avg);
- gets()
The syntax of gets function is
gets(variable);
- getch()
The syntax of getch function is:
getch(); or variable= getch();
- getche()
The syntax of getche function is:
getche();
Output
The process of getting something from the computer is called an output. Output mostly displayed on monitor. C programing language provides many built in functions to show output on monitor/screen. it is necessary to include the header files ( stdio.h) when program uses any input or output functions in program.
Some important functions for output are:
- Printf()
Syntax
The syntax of printf function is :
printf( Format string, argument_list);
Format String
Format string is given in double quotes. it may consist of text, format specifiers and escape sequences. The %d format specifier is used to show the value of integer variables. %c is used to display character, %f for float variables, %s for string variables, %lf for double and %x for hexadecimal variables.
Argument list
The argument list consist of constants, variables or expressions whose values are to be printed on the screen. Each argument in the list is separated by comma.
For Example:
printf("your marks are %d", m);
- puts()
Syntax
puts(parameter);
Parameter
it indicates the string variable in which the string is stored. In case of string constant, it is written in double quotes.
For Example:
puts("Programing makes life interesting");
No comments:
Post a Comment