0% found this document useful (0 votes)
21 views2 pages

DZ 3

Uploaded by

marinadi2009
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

DZ 3

Uploaded by

marinadi2009
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

/*dz 1 ya ne znala chto mojno ispolzovat krome char*/

#include <iostream>
using namespace std;

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

cout<<"Enter first number:";


cin>>num1;
cout<<"Enter second number:";
cin>>num2;
cout<<"Enter (+, -, *, /) ";
cin>>operation;

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"<<endl;
break;
}

return 0;
}

/*dz 2*/

#include <iostream>
using namespace std;

int main()
{
int length;
char symb;

cout<<"Enter length: ";


cin>>length;
cout<<"Enter symbol: ";
cin>>symb;

for(int i = 0; i < length; ++i)


{
cout<<symb<<endl;
}
return 0;
}

You might also like