/*-------------------------------------------------------------------*/ /* sum.c */ /*-------------------------------------------------------------------*/ #include static int i; static int iFirst; static int iSecond; static int iSum = 0; int main(int argc, char *argv[]) /* Read two integers from stdin, and write to stdout the sum of all integers between the two. */ { printf("Enter an integer: "); scanf("%d", &iFirst); printf("Enter another integer that is greater than the first: "); scanf("%d", &iSecond); for (i = iFirst; i <= iSecond; ++i) iSum += i; printf("The sum of all integers between the two is %d.\n", iSum); return 0; }