1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Allisa [31]
3 years ago
8

Write a program that mimics a calculator. The program should take as input: The first integer The second integer The operation t

o be performed (+, -, *, /)
Mathematics
1 answer:
SashulF [63]3 years ago
7 0

It takes value from a user and then user the operation of (+,-,*/).

i used c++ programming language to solve this program:

#include<iostream>

using namespace std;

int main() {

int var1, var2;

char operation;

cout << "Enter the first number : ";

cin >> var1;

cout << endl;

cout <<"Enter the operation to be perfomed : ";

cin >> operation;

cout << endl;

cout << "Enter the second nuber : ";

cin >> var2;

cout << endl;

bool right_input = false;

if (operation == '+') {

cout << var1 << " " << operation << " " << var2 << " = " << (var1 + var2);

right_input = true;

}

if (operation == '-') {

cout << var1 << " " << operation << " " << var2 << " = " << (var1 - var2);

right_input = true;

}

if (operation == '*') {

cout << var1 << " " << operation << " " << var2 << " = " << (var1 * var2);

right_input = true;

}

if (operation == '/' && var2 != 0) {

cout << var1 << " " << operation << " " << var2 << " = " << (var1 - var2);

right_input = true;

}

if (operation == '/' && var2 == 0) {

cout << "Error. Division by zero.";

right_input = true;

}

if (!right_input) {

cout << var1 << " " << operation << " " << var2 << " = " << "Error;";

cout << "Invalid Operation!";

}

cout << endl;

system("pause");

return 0;

}

You might be interested in
Write (-14/25)(45/49) in simplest form
allochka39001 [22]

-18/35

is the answer hope I am helpful

8 0
3 years ago
Wendell is looking over some data regarding the strength, measured in Pascals (Pa), of some building materials and how the stren
romanna [79]

Answer:

x = 3

Step-by-step explanation:

exponential equation:

nb=a

logarithmic equation: logna=b

If you put in 8 for f(x) your exponential equation is

2x=8

Use the pattern above to change it to a log equation

8 = 2^x

log 8 = log 2^x = xlog 2

log 2^3 = 3log 2 = xlog 2

x = 3

5 0
4 years ago
Alvaro is interested in the relationship between weather conditions and whether the downtown train runs on time. For a year, he
sladkih [1.3K]

Answer:

I got B :)))

Step-by-step explanation:

8 0
3 years ago
Read 2 more answers
What is the solution of RootIndex 3 StartRoot x + 8 EndRoot = negative 4?
erica [24]

Answer: First option.

Step-by-step explanation:

Given the following equation provided in the exercise:

\sqrt[3]{x+8}=-4

You can follow the steps indicated below in order to find the solution of this equation:

1. Cubing both sides of the equation, you get:

(\sqrt[3]{x+8})^3=(-4)^3\\\\x+8=-64

2. Finally you must subtract 8 from both sides of the equation:

x+8-8=-64-8\\\\x=-72

You can notice that this solution matches with the first option.

5 0
4 years ago
Read 2 more answers
How do you compare 77,392 67,993
S_A_V [24]

Answer: 77,392 is bigger

Step-by-step explanation:

We obviously know 77,000 is bigger 67,000. Just looking at the thousands place we can tell which number is bigger. We can also write this as 77,392 > 67,993.

Hope this helps :)

3 0
3 years ago
Other questions:
  • How to order the following fractions<br><br> 3/4 9/16 3/16 7/8 3/8
    13·2 answers
  • Lily baked 13 pies to serve at 2 different parties.
    13·2 answers
  • PLEEEASSSSEEEEE HELP ASAP!!!!! MY TIME IS LIMITTEEDDDDDD FOR TAKING THE TEST!!!! What the mean absolute deviation of the data se
    14·2 answers
  • Whats greater 1000000mm or 100m
    10·1 answer
  • As the number of pages in a photo book increases, the price of the book also increases. There is an additional shipping charge o
    8·1 answer
  • frank needs to convert 24 centimeters per second to meters per minute. which conversion factors should she use?
    10·2 answers
  • What is the measure of ZB?
    12·2 answers
  • Brainliest!!!!!!!!!!!!!!
    15·1 answer
  • What is the value of x
    5·1 answer
  • 2. In how many ways can 3 different novels, 2 different mathematics books and 5 different chemistry books be arranged on a books
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!