C examples for Statement:while
Finds sum of first 20 integers with while loop
#include <stdio.h> int main(void) { int count, sum; //from w ww. j av a 2s . co m count = 0; sum = 0; while (count++ < 20) sum = sum + count; printf("sum = %d\n", sum); return 0; }