Question
its C programming language problem Problem 1 a) First program in C We are going to create a calculator that performs the basic operations. You
its C programming language problem
Problem 1
a) First program in C
We are going to create a calculator that performs the basic operations. You need three inputs: two floating numbers and the operator. The available operators are: + addition - subtraction * multiplication / division
b) Type of variables and updating variables
// this is code please complete my code
#include
int main() { // Declare variables /* Complete here */
// Scan inputs /* Complete here */
// Perform the operation // First, we have to use an if or switch statement to know which operation we want to perform switch (operation){ case '+': // Complete here
break; case '-': result = a - b; break; case '/': if (b == 0){// we can not divide by 0 printf("It is not possible to perform the operation "); return 0; // Here we stop the program inmediately } else { // Complete here } break; case '*': // Complete here break; } printf("The result is: %.3f ", result); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started