Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
6 views6 pages

Conditional & Loops

Uploaded by

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

Conditional & Loops

Uploaded by

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

ASSIGNMENT 2

QUES 1:
What is the output of following program?

int a = 5 ;
int b = 8 ;
int c = -10 ;

if(a = a > b < c)


{
printf("If : %d %d %d\n", a, b , c) ;

if(b = a -= b += c)
{
printf("IfIf : %d %d %d\n", a, b , c) ;
}
else
{
printf("IfElse : %d %d %d\n", a, b , c) ;
}
}
else
{
printf("Else : %d %d %d\n", a, b , c) ;

if(b = b += c -= a)
{
printf("ElseIF : %d %d %d\n", a, b , c) ;
}
else
{
printf("ElseElse : %d %d %d\n", a, b , c) ;
}
}
QUES 2:
What is the output of following program?

int a = 10 ;

if(a ^= printf("CodingIsFun\n") >> printf("Hi\n"))


{
printf("In If %d\n" , a) ;
}
else
{
printf("In Else %d\n", a) ;
}
QUES 3:
What is the output of following program?

int a = 20 ;
int b = 20 ;

if(b += a++ || printf("hello\n"))


{
printf("Inside If : a : %d b : %d\n" , a , b ) ;

if(a -= b /= 5 || printf("hii\n") && printf("bye\n"))


{
printf("Inside If If : a : %d b : %d\n" , a , b) ;
}
else
{
printf("Inside If Else : a : %d b : %d\n" , a , b) ;
}
}
QUES 4:
What will be the output of following program?

int y = 8 ;
for (int i = y+= 2 ; printf("CD : %d\n", i) && i <= 12 ; printf("RE : %d\n" , i++))
{
printf("BD : %d\n" , i) ;
}
QUES 5:

What is the output of following program?

for(int i = 1 , j = 10 ; i++ , j-- , i < j ; i++, j--)


{
printf("%d %d\n" , i , j) ;
}
QUES 6:
What is the output of following program?

int count = 1 ;
do
{
if(count <= 2)
continue ;

printf("%d : in loop\n", count) ;


count++ ;
}
while (printf("%d : in condition\n", count) , count++ <= 5);

You might also like