Console I/O Operations:
The printf() Function: This function is most versatile way to display output on screen. When using printf(), you
need to include the standard input/output header file, STDIO.H.
int printf(format-string [,arguments,…]);
Format string can have: Literaltext, conversionspecifier, escapesequences.
The format-string is required; however, arguments are optional.
For each argument, there must be a conversion specifier.
We can provide optional specifier as field width.
- printf(“%10d”,456) .It means print the variable as decimal integer in the field of 10 columns.
- printf(“%10.2f “,405.3405)here 10 is for columns and 2 is for digits displayed after decimal point
|%u||unsigned int, unsigned short|
scanf(“format string”, list of addresses of variables);
The following statement inputs an integer value and a floating-point value and assigns them to the variables x and rate, respectively:
scanf(“%d %f”, &x, &rate);
Founder, Trainer & CEO, Deccansoft Software Services.
Sandeep has 21 yrs of experience working in various Microsoft Technologies/Platforms incl. VB6.0, ASP, VC++, VB.NET, C#. He is involved in managing and architecting projects at Deccansoft. He will be your liaison to Deccansoft, for any kind of communication and project updates. He knows what works and what doesn’t, and what practices are most suitable for design and programming with the ultimate goal of producing a quality system.