format specifier
#include <stdio.h>
int main()
{
int a=5;
float b=2.33;
printf("int: %d\nfloat: %10.2f",a,b);//here number between % and f specifies no of digits before and after the point
printf("\nfloat: %-10.2f u can see the space",b);//i can give negative no before point that will give space after the float no
return 0;
}
// %c= character
// %d= int
// %f= float
// %l= long integer
// %lf= double
// %Lf= long double
Comments
Post a Comment