
Input and Output in C 93
Explanation:
From the above program, it is very clear that if format strings are separated by commas, the
inputs should also be separated by commas. The readers are advised to try this by writing more
programs. Table 4.2 describes the formats for the various inputs.
void main()
{
int a,b,c;
clrscr();
printf(“\nEnter values :”);
scanf(“%d, %d,%d”,&a,&b,&c);
printf(“a=%d b=%d c=%d”,a,b,c);
}
OUTPUT:
Enter values: 4,5,8
a=4 b=5 c=8
Table 4.2 Formats for the various inputs
Sr. No. Format Meaning
Explanation
1.
%wd
Format for integer input w is width in integer and d conversion
specification
2.
%w.cf
Format for float point input ...