Write a program that mimics a calculator. The program should take as input two integers and the operation to be performed. It should then output the numbers, the operator, and the result. (For division, if the denominator is zero, output an appropriate message). Some sample outputs follow:3 + 4 = 713 * 5 = 65

Respuesta :

A program that mimics a calculator:

#include <stdio.h>

int main(void)

{

   int num1, num2;

   char operation;

   printf("Please enter two integers and an operator (+, -, *, /): ");

   scanf("%d %c %d", &num1, &operation, &num2);

   if (operation == '+')

       printf("%d + %d = %d\n", num1, num2, num1 + num2);

   else if (operation == '-')

       printf("%d - %d = %d\n", num1, num2, num1 - num2);

   else if (operation == '*')

       printf("%d * %d = %d\n", num1, num2, num1 * num2);

   else if (operation == '/')

   {

       if (num2 == 0)

           printf("Cannot divide by zero!\n");

       else

           printf("%d / %d = %d\n", num1, num2, num1 / num2);

   }

   else

       printf("Invalid operator!\n");

   return 0;

}

What is program?
A program is a set of instructions that a computer follows to perform a specific task. It is a set of instructions written in a programming language that tells a computer how to perform a specific task. A program can be used to control a computer, create software, and manage data. A program can be written in many different programming languages, such as C, Java, Python, and JavaScript. Programs are used in many different industries to create applications, games, and websites. They are also used to manage data sources and automate tasks. By writing code, developers can create powerful programs that are able to do complex tasks quickly and efficiently.

To learn more about program
https://brainly.com/question/25324400
#SPJ4