- 1

why do we put %d

14th Aug 2020, 7:56 AM
Pratik Yadav
Pratik Yadav - avatar
2 Answers
+ 14
C uses formatted output. The 'printf' function has a special formatting character (%) — a character following this defines a certain format for a variable: %c — characters %d — integers %f — floats e.g. printf("%c %d %f", ch, i, x);
14th Aug 2020, 8:02 AM
ÃKR - avatar
+ 2
Furthering to ÃKR , you can use scanf for taking input: scanf("%c %d %f",&ch,&i,&x); Note that:you have to use a & operator which indicates the address of ch,i and x variable .
14th Aug 2020, 8:11 AM
The future is now thanks to science
The future is now thanks to science - avatar