This commit is contained in:
2025-07-17 11:31:11 +09:00
parent 1cc0c43954
commit e304f900ee
29 changed files with 281 additions and 107 deletions

23
programs/p413/main.c Normal file
View File

@@ -0,0 +1,23 @@
#include <stdio.h>
int main(void) {
int n;
int sum = 0;
numInput:
printf("Input integer: ");
scanf("%d", &n);
if (n < 1) {
puts("Error: Please type in non-zero positive integer.");
goto numInput;
}
for (int i = 1; i <= n; i++) {
sum += i;
}
printf("ANS: %d", sum);
return 0;
}