#include <stdio.h> int main() { int a[20],b=0,c,j=0,sum=0; for (int i = 1; i <= 100; i++) { if (i % 7 == 0) { b++; a[b] = i; } c = b; } for (b; b > 0; b--) sum = sum + a[b]; printf("1~100之间7的倍数的数有%d个,总和为%d", c, sum); }
2023-11-14 14:33:22
#include <stdio.h> int main() { int a[20],b=0,c,j=0,sum=0; for (int i = 1; i <= 100; i++) { if (i % 7 == 0) { b++; a[b] = i; } c = b; } for (b; b > 0; b--) sum = sum + a[b]; printf("1~100之间7的倍数的数有%d个,总和为%d", c, sum); }