Hi,
I am a beginner in C programming, and when trying to see how the type "float" works, I typed in
Code:
#include <stdio.h>
int main(int argc, const char * argv[]) {
// insert code here...
int a;
float b;
a = getchar();
b = a/100;
printf("%1.3f\n",b);
}
but the results, whatever it should be, would only give me 0.000
And I get weird numbers too here,
Code:
int main(int argc, constchar * argv[]) {// insert code here...
float b;
b = getchar();
printf("%1.3f\n",b);
}
It would be great if you could teach me why it gives me these totally wrong answers and how to fix it.
Thanks a lot!