标签:
# include <stdio.h> int main() { int x,y,z,a,b; printf("请输入三个要比较的整数:"); scanf("%d %d %d",&x,&y,&z); if (x>y) { a=x; } else { a=y; } if (a>z) { b=a; } else { b=z; } printf("最大的数为:%d",b); return 0; }
#include<stdio.h> int main() { int a,b; printf("请输入车速和限速:"); scanf("%d %d",&a,&b); double c=(double)(a-b)*100/b; if(c<=10) printf("未超速"); else if(c<50 && c>10) printf("超速,罚款200元",c); else printf("严重超速,吊销驾驶证",c); return 0; }
#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 i,j,k; for(j=1;j<=10;j++) { for(k=1;k<j;k++) printf(" "); for(i=1;i<=11-j;i++) printf("*"); printf("\n"); } return 0; }
标签:
原文地址:http://www.cnblogs.com/wzcshishuaige12/p/5958602.html