C examples for Statement:for
Do a calculation within the third control expression in a for loop
#include <stdio.h> int main(void) { unsigned long long sum = 0LL; // Stores the sum of the integers unsigned int count = 0; // The number of integers to be summed printf("\nEnter the number of integers you want to sum: "); scanf(" %u", &count); for(unsigned int i = 1 ; i <= count ; sum += i++); printf("\nTotal of the first %u numbers is %llu\n", count, sum); return 0;/*from ww w .j a v a2 s.c o m*/ }