scanf(\
while (score>100||score<0) {printf(\输入有误,请重输\ scanf(\ }
switch((int)(score/10)) {case 10: case 9: grade='A';break; case 8: grade='B';break; case 7: grade='C';break; case 6: grade='D';break; case 5: case 4: case 3: case 2: case 1: case 0: grade='E'; }
printf(\成绩是 %,相应的等级是%c\\n \ return 0; } 4-9
#include <> #include <> int main() {
int num,indiv,ten,hundred,thousand,ten_thousand,place; return 0; } 5-6
#include <> int main()
{double s=0,t=1; int n;
for (n=1;n<=20;n++) {
t=t*n; s=s+t; }
.=%d\\n\ printf(\ return 0; } 5-7
#include <> int main() {
int n1=100,n2=50,n3=10; double k,s1=0,s2=0,s3=0;
for (k=1;k<=n1;k++) /*计算1到100的和*/ {s1=s1+k;}
for (k=1;k<=n2;k++) /*计算1到50各数的平方和*/ {s2=s2+k*k;}
for (k=1;k<=n3;k++) /*计算1到10的各倒数和*/ {s3=s3+1/k;}
printf(\ return 0; } 5-8
#include <> int main() {
int i,j,k,n;
printf(\ for (n=100;n<1000;n++) {
i=n/100; j=n/10-i*10; k=n;
if (n==i*i*i + j*j*j + k*k*k) printf(\ }
printf(\ return 0; }
5-9-1
#define M 1000 /*定义寻找范围*/ #include <> int main()
{
int k1,k2,k3,k4,k5,k6,k7,k8,k9,k10; int i,a,n,s;
for (a=2;a<=M;a++) /* a是2-1000之间的整数,检查它是否完数 */ {n=0; /* n用来累计a的因子的个数 */