胡明浩 160809313 (我就会三个)
#include<stdio.h> int main()//打印三角形 { int i,j; for(j=1;j<=10;j++) { for(i=1;i<=11-j;i++) { printf("*"); } printf("\n"); }
#include <stdio.h> int main()//五级制成绩分布 { int i,A,B,C,D,E,n,s; A=B=C=D=E=0; printf("Enter n:"); scanf("%d",&n); for(i=0;i<n;++i) { printf("Enter grade %d:",i+1); scanf("%d",&s); switch(s/10) { case 1: case 2: case 3: case 4: case 5:E++;break; case 6:D++;break; case 7:C++;break; case 8:B++;break; case 9: case 10:A++;break; } } printf("The number of A(90~100):%d\n",A); printf("The number of B(80~89):%d\n",B); printf("The number of C(70~79):%d\n",C); printf("The number of D(60~69):%d\n",D); printf("The number of E(0~59):%d\n",E); return 0;
#include<stdio.h> int main()//高速公路限速处罚 { int x,y; scanf("%d %d",&x,&y); double b = (double)(x-y)*100/y; if (b>50)printf("超过限速 %.0f%%. 吊销执照",b); if(b>=10&&b<=50)printf("超出限速 %.0f%%. 罚款 200",b); if(b<10)printf("未超过限速"); }