0% found this document useful (0 votes)
31 views

Control Structure-Multip

C programming
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)
31 views

Control Structure-Multip

C programming
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/ 2

Control Structure

Find out the output of the following Programs

SLNO QUESTIONS SLNO QUESTIONS


1 main() 2 main()
{ {
int k=6; int a=2;
switch(k) a--;
{ switch(a)
default: k+=2; {
case 4: k=4; switch(a)
case 5: k++; {
break; case 1:
} printf("hello");
printf("%d",k); break;
} case 2:
printf("hi");
break;
}
}
}
3 main() 4 main()
{ {
char as[]="\\0\0"; int a=2,b=3;
int i=0; do
do {
{ a=a^b;
switch(as[i++]) b=b^a;
{ a=a^b;
case '\\': continue;
printf("a"); }
break; while(a==3);
case 0: printf("%d%d",a,b);
printf("b"); }
break;
default:
printf("c");
}
break;
}
while(as[i]!='\0');
}
5 main() 6 main()
{ {
int i,j; int i;
for(i=1,j=5;i++,j--;) for(i=0;i<10;i++)
{ {
if(i==j) switch(i)
continue; {
printf("%d",i); case 0:i+=0;
} case 1:i+=1;
case 2:i+=2;
} default:i+=3;
break;
}
printf("%d",i);
}
7 int main(int k) 8 main()
{ {
if(k<5) for(putchar('g');putchar('o');putchar('d'))
printf("%d",main(k+1)); putchar('s');
return k; }
}
9 main() 10 main()
{ {
char as[]="\\0\0"; char ch;
int i=0; for(ch=0;ch<128;ch+4)
do printf("%d",ch);
{ }
switch(as[i++])
{
case '\\':printf("a");
break;
case 0: printf("b");
break;
default: printf("c");
break;
}
}
while(i);
}

You might also like