#include <iostream>
using namespace std;
int globalVar = 10 ;
int arithmeticOperations( int a, int b) {
int resultSubtract = a - b;
int resultMultiply = a * b;
cout << "Subtraction result: " << resultSubtract << endl;
cout << "Multiplication result: " << resultMultiply << endl;
return resultSubtract;
return resultMultiply;
}
int main( ) {
int arr[ ] = { 1 , 34 , 56 , 7 , 12 } ;
int x, y;
cout << "Enter the first number: " ;
cin >> x;
cout << "Enter the second number: " ;
cin >> y;
arithmeticOperations( x, y) ;
string input;
cout << "Enter 'yes' or 'no': " ;
cin >> input;
if ( input == "yes" ) {
cout << "You entered 'yes'!" << endl;
}
else if ( input == "no" ) {
cout << "You entered 'no'!" << endl;
}
else {
cout << "Unknown input!" << endl;
}
int option;
cout << "Enter a number between 1 and 3: " ;
cin >> option;
switch ( option) {
case 1 :
cout << "You chose the first option" << endl;
break ;
case 2 :
cout << "You chose the second option" << endl;
break ;
case 3 :
cout << "You chose the third option" << endl;
break ;
default :
cout << "Invalid choice" << endl;
}
for ( int i = 0 ; i < 5 ; i++ ) {
cout << "Array element (after) [" << i << "] = " << arithmeticOperations( arr[ i] , globalVar) << endl;
}
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IGdsb2JhbFZhciA9IDEwOwoKaW50IGFyaXRobWV0aWNPcGVyYXRpb25zKGludCBhLCBpbnQgYikgewogICAgaW50IHJlc3VsdFN1YnRyYWN0ID0gYSAtIGI7CiAgICBpbnQgcmVzdWx0TXVsdGlwbHkgPSBhICogYjsKICAgIGNvdXQgPDwgIlN1YnRyYWN0aW9uIHJlc3VsdDogIiA8PCByZXN1bHRTdWJ0cmFjdCA8PCBlbmRsOwogICAgY291dCA8PCAiTXVsdGlwbGljYXRpb24gcmVzdWx0OiAiIDw8IHJlc3VsdE11bHRpcGx5IDw8IGVuZGw7CgogICAgcmV0dXJuIHJlc3VsdFN1YnRyYWN0OwogICAgcmV0dXJuIHJlc3VsdE11bHRpcGx5Owp9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