Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C by switchcase ( 6 years ago )
#include <stdio.h>
int a, b;
char x;
int main()
{
printf("Nhap phep toan: ");
scanf("%c", &x);
printf("Nhap 2 so: ");
scanf("%d %d", &a, &b);
switch(x)
{
case '+':
{
printf("%d + %d = %d", a, b, a + b);
break;
}
case '-':
{
printf("%d - %d = %d", a, b, a - b);
break;
}
case '*':
{
printf("%d * %d = %d", a, b, a * b);
break;
}
case '/':
{
if(b == 0)
{
printf("Khong the chia cho 0!");
}
else
{
printf("%d / %d = %2f", a, b, (float)a / b);
break;
}
}
default:
{
printf("Khong co phep toan");
break;
}
}
return 0;
}
Revise this Paste