help:- character counting program | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

help:- character counting program

#include<stdio.h> int main() { double i; for(i=0 ;getchar()!=EOF ;i++) { printf ("%d",i); } } the output for 1 is 2-1425436615 why? plz explain

3rd Jan 2018, 2:23 PM
‎ ‏‏‎Anonymous Guy
2 Answers
+ 4
To print double, you need %f instead of %d
4th Jan 2018, 7:59 AM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
thank you for your help
5th Jan 2018, 3:08 AM
‎ ‏‏‎Anonymous Guy