main() { int score; scanf("%d",&score); if(score>=60) printf("C语言成绩及格!\n"); }
main() { int a,b,t; scanf("%d%d",&a,&b); if(a>b) { t=a; a=b; b=t; } printf("a=%d,b=%d\n",a,b); }
main() { int n; scanf("%d",&n); if(n%2==0) printf("该数是偶数!\n"); else printf("该数是奇数!\n"); }
main() { int pwd; scanf("%d",&pwd); if(pwd==123456 ) printf(“密码正确,登录成功!\n"); else printf("密码错误,无法登录!\n"); }
main() { float Amount,ActualAmount; scanf("%f",&Amount); if(Amount>=10000) ActualAmount=Amount*0.5; else if(Amount>=8000) ActualAmount=Amount*0.6; else if(Amount>=5000) ActualAmount=Amount*0.7; else if(Amount>=3000) ActualAmount=Amount*0.8; else if(Amount>=1000) ActualAmount=Amount*0.9; else ActualAmount=Amount; printf("付款:%f元\n",ActualAmount); }
main() { int x,y; scanf("%d%d",&x,&y); if(x>0) if(y>0) printf("该点属于第一象限!\n") else printf("该点属于第四象限!\n"); else if(y>0) printf("该点属于第二象限!\n"); else printf("该点属于第三象限!\n"); }
main() { int score,temp; char grade; scanf("%d",&score); temp=score/10; switch(temp) { 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",grade); }
时间: 2024-10-11 07:05:58