Professional Documents
Culture Documents
Indian Institute of Technology Roorkee MIN-103: Programming and Data Structures Tutorial 4
Indian Institute of Technology Roorkee MIN-103: Programming and Data Structures Tutorial 4
2. Write a code to find out largest number out of three entries given by user. Use if-
else statements for performing the operation.
3. By writing a c++ code, determine the output of the following code snippet
int main()
{
int a,b;
cin>>a>>b;
bool x,y;
4. By writing a c++ code, determine the output of the following code snippet and
justify your answer in the notebook.
int main()
{
int a = 21;
int c ,d;
c = a++;
d= --a;
cout << c<<”\t”<<d<<endl;
return 0;
}
5. By writing a c++ code, determine the output of the following code snippet and
justify your answer in the notebook
int main()
{
int x = 5, y = 5, z;
x = ++x; y = --y;
z = x + ++x;
cout << z;
return 0;
}
6. By writing a c++ code, determine the output of the following code snippet and
justify your answer in the notebook. Determine any problem in the program if it
exits.
int main()
{
int x,y;
cin>>x>>y;
if(x != y )
if(x>y)
cout<<”x is greater than y\n”;
else
cout<<”x is less than y \n” ;
return 0;
}
7. Write a code for simple calculator which can perform (+, -, *, /). Use if-else-else
if statements.