This commit is contained in:
2023-10-06 13:47:33 +01:00
parent 2d6791220f
commit 317d7f837e
7 changed files with 157 additions and 0 deletions

29
C9/ex6.c Normal file
View File

@@ -0,0 +1,29 @@
#include <stdio.h>
int main() {
int rc, start, end;
printf("Start: ");
rc = scanf("%d", &start);
if (rc != 1) {
printf("Please enter a real integer\n");
return 1;
}
printf("End: ");
rc = scanf("%d", &end);
if (rc != 1) {
printf("Please enter a real integer\n");
return 1;
}
if (start > end) {
printf("Please ensure that start value is smaller than end value\n");
return 1;
}
for (int i = start; i <= end; i++) {
printf("%d\n", i);
}
return 0;
}