Computer Science, asked by QueenSaanvi, 16 hours ago

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 IlMYSTERIOUSIl
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

\rule{300}{2}

(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

\rule{300}{2}

(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

\rule{300}{2}

(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 Oreki
4

{\bf Out put}

   \textsf{a) 4}\\\textsf{\:\:\:\: 9}\\\textsf{\:\:\:\: 1}

   \textsf{b) \: a=13}

   \textsf{c) \: 10}

   \textsf{d) 11-11}\\\textsf{\:\:\:\: 3}

Similar questions