This commit is contained in:
2025-07-03 12:05:57 +09:00
parent e10edbe753
commit fea9a38b1d
27 changed files with 255 additions and 98 deletions

21
programs/p42/main.c Normal file
View File

@@ -0,0 +1,21 @@
#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;
}