|
#include void main() { int a,b; printf(" lease enter 'a' and 'b':\n"); scanf("%d%d",&a,&b); if(a%b==0) printf("a equipped b\n"); else printf("a don't equipped b\n"); } 5-2 #include void main() { int a,b; printf(" lease 'a' and 'b':\n"); scanf("%d%d",&a,&b); if(a*b>1000) printf("%d*%d>1000\n",a,b); else if(a*b==1000) printf("%d*%d=1000\n",a,b); } 5-3 #include void main() { int a,b; printf(" laese enter 'a' and 'b':\n"); scanf("%d%d",&a,&b); if(a-b==a||b-a==a) printf("Difference is equal to value \n",a); else if(a-b==b||b-a==b) printf("Difference is equal to value \n",b); else printf("Difference is not equal to any of values entered\n"); } 5-4 #include void main() { char Gread; int pay; printf("Please enter 'Gread' and 'pay':\n"); scanf("%c%d",&Gread,&pay); switch(Gread) { case 'A': printf("Gongzi is %d\n",pay+300); break; case 'B': printf("Gongzi is %d\n",pay+250); break; default: printf("Gongzi is %d\n",pay+100); break; } } 5-5 #include void main() { int marks; printf("Please enter 'marks':"); scanf("%d",&marks); if(marks>75) printf("A级\n"); else if(marks>=60 && marks=45 && marks=35 && marks<45) printf("D级\n"); else printf("E级\n"); } |
|