rendered paste body/*指定された演算をする*/#include<stdio.h>int main(){ int num1; /*1つめの値*/ int num2; /*2つめの値*/ int type; /*演算の種類*/ printf("1つめの値を入力してください。\n"); fflush(stdout); scanf("%d",&num1); printf("2つめの値を入力してください。\n"); fflush(stdout); scanf("%d",&num2); type = 0; while(type<2 || type>4) { printf("計算方法を番号で指定してください。\n"); printf("1.足し算 2.引き算 3.掛け算 4.割り算\n"); fflush(stdout); scanf("%d",&type); if(type>=1&&type<=4){ break; } else { printf("計算方法には1から4までの番号を指定してください。\n"); } } printf("***計算結果***\n"); if(type==1){ printf("%d+%dは%d\n",num1,num2,num1+num2); } else if(type==2){ printf("%d-%dは%d\n",num1,num2,num1-num2); } else if(type==3){ printf("%d*%dは%d\n",num1,num2,num1*num2); } else if(type==4){ printf("%d/%dは%d余りは%d\n",num1,num2,num1/num2,num1%num2); } return 0;}