Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

#include <iostream>

using namespace std;

int main()
{
int a,max,i,num,sum,q,initiative_number;
cout << "This is a Console Application" << endl;
cout << " " << endl;
cout << " A basic Calculator " << endl;
cout << " " << endl;
cout << " " << endl;
cout << " MENU " << endl;
cout << " " << endl;
cout << "for + press 1" << endl;
cout << "for - press 2" << endl;
cout << "for * press 3" << endl;
cout << "for / press 4" << endl;
cout << "for mod press 5" << endl;
cout << "for GCD press 6" << endl;
cout << "for LCM press 7" << endl;
again:
cin >> a;
switch (a)
{
case 1:
cout << "How numbers you want to sum ? : ";
cin >> max;
sum = 0;
for (i = 1; i < max + 1; i++){
cout << "Enter the " << i << "number :";
cin >> num;
sum += num;
}
cout << "The sum is " << sum << endl;
break;
case 2:
cout << "Enter the initiative number: ";
cin >> initiative_number;
sum = initiative_number;
cout << "How numbers want to subtract from inotiative number? : ";
cin >> max;
for (i = 1; i < max + 1; i++){
cout << "Enter the " << i << "number :";
cin >> num;
sum -= num;
}
cout << "The subtraction is " << sum << endl;
break;
default:
cout << "Error " << endl;
cout << "please make a valuable choise: ";
goto again;
break;
}
cin >> q;
return 0;
}

You might also like