program in C launches correctly but printf doesnt show anything -
i run programm , console appears printf doesnt print anything, how can fix this?
#include<stdio.h> main() { float fa; int cel; cel=0; while(cel<=200); { fa=9.000*(cel+32.000)/5.000; printf("%d\t%.3f\n",cel,fa); cel=cel+20; } } in addition have similar program runs correctly
#include<stdio.h> main() { float celsius; int fahr; fahr = 0; while(fahr<=100){ celsius=5.0000*(fahr-32.0000)/9.0000; printf("%d\t%.4f\n",fahr,celsius); fahr=fahr+1; } } i ran both programs in c-free 5
infinite loop:
while(cel<=200); because of trailing ; equivalent to:
while(cel<=200) {} which means printf() never reached , cel never modified. remove ; correct.
Comments
Post a Comment