Please edit my code thankyou to the given picture #include int main() { char ch; double firstN, secondN; printf("Enter an choice (+, -, *, /): "); scanf("%c", &ch); printf("Enter two numbers: "); scanf("%lf %lf", &firstN, &secondN); switch (ch) { case '+': printf("The addition of %.1lf and %.1lf is %.1lf", firstN, secondN, firstN + secondN); break; case '-': printf("The Subtraction of %.1lf anf %.1lf is %.1lf", firstN, secondN, firstN - secondN); break; case '*': printf("The multipication of %.1lf * %.1lf is %.1lf", firstN, secondN, firstN * secondN); break; case '/': printf("The division of %.1lf and %.1lf is %.1lf", firstN, secondN, firstN / secondN); break; default: printf("Invalid input"); } return 0; }
Please edit my code thankyou to the given picture
#include <stdio.h>
int main() {
char ch;
double firstN, secondN;
printf("Enter an choice (+, -, *, /): ");
scanf("%c", &ch);
printf("Enter two numbers: ");
scanf("%lf %lf", &firstN, &secondN);
switch (ch) {
case '+':
printf("The addition of %.1lf and %.1lf is %.1lf", firstN, secondN, firstN + secondN);
break;
case '-':
printf("The Subtraction of %.1lf anf %.1lf is %.1lf", firstN, secondN, firstN - secondN);
break;
case '*':
printf("The multipication of %.1lf * %.1lf is %.1lf", firstN, secondN, firstN * secondN);
break;
case '/':
printf("The division of %.1lf and %.1lf is %.1lf", firstN, secondN, firstN / secondN);
break;
default:
printf("Invalid input");
}
return 0;
}
Step by step
Solved in 4 steps with 2 images