Two Formatted Input and Output Functions, C language Assignment Help

Assignment Help: >> Introduction to C language >> Two Formatted Input and Output Functions, C language

Two formatted input and output functions

 These two functions are very frequently used in programming and provide a provision for inputting and outputting data or messages.

 

1. printf(): It is used to print the constant value, literal value or values contained in the variables on the screen. The general form of printf() is:

printf("<format conversion string specification>", <list of variables/constants>);

 

2. scanf(): it is used to scan values from the keyboard. Thus, makes a provision for supplying values of variables through the keyboard in the program. The general form of scanf() is:

scanf("<format conversion string specificaton>",&<list of variable addresses >);

For example:

void main()

{

                int a,b,c,avg;

                printf("Enter values for a, b and c:");

                scanf("%d %d %d",&a,&b,&c);

                avg=(a+b+c)/3;

                printf("avg=%d",avg);

}

Note: While supplying values for continuous variables through keyboard at runtime, values typed on the screen must be separated by a blank, a tab or a new line (enter).

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd