0
What is the use of coefficients before %f and %d
What is the use of placing numbers like 2 and symbols like * in scanf("%2d%*f",&a,&b)
6 ответов
+ 3
%2d means that it will take either one or two digit number. If you enter more than two digits number, it will skip after two digits.
If you input 24568, it will skip last three digits and will accept only first two digits i.e 24.
%*f means that the input of this variable will be skipped
Refer to this section :
https://www.sololearn.com/learn/C/2914/
0
If you have %2d it means it will print integer number with the width at least 2 wide, %.*f will printout float number with the width of 6 numbers after the comma
0
Is it ok when we use only%f or %d in the place is %2d or %*f
0
If you use only %*f in that case you won't get any output
0
Thank you
0
Any one more precise about %*f in the following
int a,b;
char c[10];
scanf("%2d %d %*f %5s",&a,&b,&c);
printf,("\n %d%d%s",a,b,c);
i removed %*f in scanf and gave input
12
231456
tri
it is showing 12 231 456
can you explain why