Skip to content

Commit

Permalink
Create tecky708#75
Browse files Browse the repository at this point in the history
  • Loading branch information
Jethendra-17 authored Oct 21, 2023
1 parent 62e2480 commit 19acc9a
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions #75
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include<iostream>
using namespace std;

int main() {
int num1, num2;
char operation;

cout << "Enter first number: ";
cin >> num1;

cout << "Enter operator (+, -, *, /): ";
cin >> operation;

cout << "Enter second number: ";
cin >> num2;

switch(operation) {
case '+':
cout << "Result: " << num1 + num2 << endl;
break;
case '-':
cout << "Result: " << num1 - num2 << endl;
break;
case '*':
cout << "Result: " << num1 * num2 << endl;
break;
case '/':
if(num2 != 0)
cout << "Result: " << num1 / num2 << endl;
else
cout << "Error! Division by zero is not allowed.";
break;
default:
cout << "Invalid operator!";
break;
}

return 0;
}

0 comments on commit 19acc9a

Please sign in to comment.