#include <stdio.h> int main(void) { int sum = 0; int i; while(i != 0){ printf("put the number: \n"); scanf("%d", &i); sum += i; } printf("sum is %d", sum); return 0;}
10 20 30 40 5 0
put the number: put the number: put the number: put the number: put the number: put the number: sum is 105
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!