+ 2

can you write a program calculate the (+; - ; % ; * ;/;) of 3 variable x,y,z with you progrmming language ?!

let's start !!!

11th Apr 2017, 7:15 AM
ismail Banouigu
ismail Banouigu - avatar
6 Respuestas
+ 10
Allright, this is a good coding challenge
11th Apr 2017, 8:41 AM
Gami
Gami - avatar
+ 6
There are plenty attempts at calculators here in SoloLearn, just search for them. In fact there are so many, this challenge isn't even really a challenge.
11th Apr 2017, 8:49 AM
SoraKatadzuma
SoraKatadzuma - avatar
+ 5
#include <iostream> using namespace std; int main (void){ //two input and one output int a, b, c; char op; //for operation + - / * //Read values cout<<"Enter first value: "; cin>>a; cout<<"Enter second value: "; cin>>b; //Read Operator cout<<"Enter operation (+ - * / %): "; cin>>op; c=0; switch (op){ case '/': if (b==0){ cerr<<"Runtime Error: Division by zero is not possible.\nExiting Program"; return -1; } c = a / b; break; case '*': c = a * b; break; case '+': c = a + b; break; case '-': c = a - b; break; case '%': c = a % b; break; default: cout<<"Invalid operation"; return -1; } cout<<"Result = "<<c; }
11th Apr 2017, 10:31 AM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar
+ 3
good work Davender
11th Apr 2017, 11:41 AM
ismail Banouigu
ismail Banouigu - avatar
+ 2
good work Davender
11th Apr 2017, 11:41 AM
ismail Banouigu
ismail Banouigu - avatar
+ 1
just do it
11th Apr 2017, 7:51 AM
ismail Banouigu
ismail Banouigu - avatar