+ 1

Trying while in c pls help

Why this doesnt work #include <stdio.h> int main() { int num; int nomor; int total; while (num<5) {scanf("%d",&nomor); num++; total+=nomor;} printf("%d",total); return 0; }

24th Sep 2019, 12:29 AM
Flash n
Flash n - avatar
2 Antworten
+ 3
Flash n you forget to give the value to the num variable. e.g int num=0; Try this it will work.
24th Sep 2019, 2:42 AM
Maninder $ingh
Maninder $ingh - avatar
0
Thanks
24th Sep 2019, 6:08 AM
Flash n
Flash n - avatar