Write the output of the following programs (consider all required header files and getch():
(a) void main()
{
int a=20,b=4;
a /= 5;
b +=5;
cout<<a<<"\n"<<b;
cout<<"\n"<<b%a;
(b) void main()
{
int a=1;
a=2;
a=a+5*a;
cout<<"a="<<++a;
}
(c) void main()
{
int a=10;
int b=3;
int max=0;
(a/b)? max=a : max=b;
cout<<max;
}
(d) void main()
{
int a = 11,b;
b= +-a;
cout<<a<<b++<<"\n";
cout<<++a + ++b;
}
Answers
Answered by
30
Write the output of the following programs (consider all required header files and getch():
(a)
Ans -
#include<iostream.h>
#include<conio.h>
void main()
{
int a=20,b=4;
a /= 5;
b +=5;
cout<<a<<"\n"<<b;
cout<<"\n"<<b%a;
getch();
}
Output -
4
9
1
(b)
Ans -
#include<iostream.h>
#include<conio.h>
void main()
{
int a=1;
a=2;
a=a+5*a;
cout<<"a="<<++a;
getch();
}
Output -
a = 13
(c)
Ans -
#include<iostream.h>
#include<conio.h>
void main()
{
int a=10;
int b=3;
int max=0;
(a/b)? max=a : max=b;
cout<<max;
getch();
}
Output -
10
(d)
Ans -
#include<iostream.h>
#include<conio.h>
void main()
{
int a = 11,b;
b= ++a;
cout<<a<<b++<<"\n";
cout<<++a + ++b;
getch();
}
Output -
1212
27
Attachments:
Answered by
4
Similar questions
English,
1 month ago
Math,
2 months ago
Computer Science,
2 months ago
Science,
9 months ago
Math,
9 months ago