#include<stdio.h>
void main(){
int num
scanf("%d",&num)
while(num<=0){
printf("必须输入一个大于0的正整数!\n\n")
printf("请输入一个正整数:")
scanf("%d",&num)
}
printf("数字%d除以5",num)
switch(num%5){
case 1:
printf("余数是1!")
break
case 2:
printf("缓饥此余数是2!")
break
case 3:
printf("余数是3!")
break
case 4:
printf("余数是4!")
break
default:
printf("肢毕余数是0!")
break
}
printf("\n")
}
#include \x0d\x0aint main( )\x0d\x0a{\x0d\x0a double a, b\x0d\x0a char op\x0d\x0a scanf("%lf%c%lf", &a, &op, &b)\x0d\x0a switch (op)\x0d\x0a {\x0d\x0a case '+':\x0d\x0a printf("%lf + %lf = %lf\n", a, b, a + b)\x0d\x0a break\x0d\x0a case '-':\x0d\x0a printf("%lf - %lf = %lf\n", a, b, a - b)\x0d\x0a break\x0d\x0a case '*':\x0d\x0a printf("%lf * %lf = %lf\n", a, b, a * b)\x0d\x0a break\x0d\x0a case '/':\x0d\x0a if (b != 0)\x0d\x0aprintf("%lf / %lf = %lf\n", a, b, a / b)\x0d\x0a else\x0d\x0a printf("除数不能是0! \n")\x0d\x0a break\x0d\x0a }\x0d\x0a}欢迎分享,转载请注明来源:内存溢出
评论列表(0条)