#include <stdio.h>
#include <stdlib.h>
int main()
{
char latter;
printf("What operation you want to do?\n\t A)Addition\n\t B)Subtraction\n\t C)Multiplication\n\t D)Division\n\n\nEnter Your Choice: ");
scanf("%c", &latter);
float num1, num2;
printf("\n\tplease enter the first number: ");
scanf("%f", &num1);
printf("\n\tplease enter the second number: ");
scanf("%f", &num2);
if(latter == 'A' || latter == 'a')
printf("\n\tthe sum is %.2f", num1+num2);
else if(latter == 'B' || latter == 'b')
printf("\n\tthe difference is %.2f", num1-num2);
else if(latter == 'C' || latter == 'c')
printf("\n\tthe multiplication is %.2f", num1*num2);
else if(latter == 'D' || latter == 'd')
printf("\n\tthe division is %.2f", num1/num2);
else
printf("\n\tyou entered a invalid character");
return 0;
}
#include <stdlib.h>
int main()
{
char latter;
printf("What operation you want to do?\n\t A)Addition\n\t B)Subtraction\n\t C)Multiplication\n\t D)Division\n\n\nEnter Your Choice: ");
scanf("%c", &latter);
float num1, num2;
printf("\n\tplease enter the first number: ");
scanf("%f", &num1);
printf("\n\tplease enter the second number: ");
scanf("%f", &num2);
if(latter == 'A' || latter == 'a')
printf("\n\tthe sum is %.2f", num1+num2);
else if(latter == 'B' || latter == 'b')
printf("\n\tthe difference is %.2f", num1-num2);
else if(latter == 'C' || latter == 'c')
printf("\n\tthe multiplication is %.2f", num1*num2);
else if(latter == 'D' || latter == 'd')
printf("\n\tthe division is %.2f", num1/num2);
else
printf("\n\tyou entered a invalid character");
return 0;
}
No comments:
Post a Comment