The Printf () function
Printf is a function in c language. We will discuss about the functions in different in deep . Lets
have a look at the printf() function.
The printf function is used to display information required to the user and also prints the value of
the variables . We also uses a semi colon at the end of the braces of printf function.
We can use printf function in three different ways:-
These are as follows :-
- Printf("string to be printed");
- Printf("format specifier", variable list);
- Printf("string with format specifier",variable list);
Example 1: C Output
Output
"Welcome to the field of programming"
The Scanf() Function
The scanf() is used to read Formatted data from the keyboard . The syntax of the scanf() function can be given as
Scanf("format specifier", variable list);
The format specifier specifies the types and format of the data that has to be obtained from the keyboard and stored in the memory locations.
scanf("%d",& variable name );
Example 1: Add two numbers.
Output
enter two numbers to add 10,5
=15
0 Comments