It is used to describe the
number of columns that should be used to print a value on the console screen
(black output screen).
For integer values
Syntax:
flag width.precision
Example:
int a=35;
Printf (“ integer value=%4d”,a);
Output
integer value=_ _35
integer value=_ _35
For
floating point values
Syntax:
%m.nf
Example
#include<stdio.h>
#include<conio.h>
void main ()
{
float b=3.14159;
print f(“float value=%4.2f”,b);
getch();
}
Output
float
value=3.14
No comments:
Post a Comment