Files
information-processing-1_12…/programs/p42/main.c
2025-07-03 12:05:57 +09:00

22 lines
351 B
C

#include <stdio.h>
int main(void) {
int a, b, i, ans;
printf("Input upper limit: ");
(void)scanf("%d", &a);
printf("Input lower limit: ");
(void)scanf("%d", &b);
i = b;
ans = 0;
do {
ans += i++;
} while (i <= a);
printf("Sum of all integer between %d and %d is %d.\n", b, a, ans);
return 0;
}