第七课选做题。

This commit is contained in:
unlockable
2022-11-02 19:44:17 +08:00
parent 28898732bc
commit e5b23334fe
5 changed files with 183 additions and 0 deletions

14
07/Optional02.c Normal file
View File

@@ -0,0 +1,14 @@
#include <stdio.h>
int main() {
int a, b, n, count=0;
printf("Please input a, b, n: ");
scanf("%d %d %d", &a, &b, &n);
for (;n>0;n--) {
count += a*b;
a--;
b--;
}
printf("The total number is %d", count);
return 0;
}