C Programming :: Control Structures
-
What will be the output of given program?
#include<stdio.h>
void main()
{
int a=1;
if("%d=hello", a);
}
-
What will be the output of given program?
#include<stdio.h>
void main()
{
int a=3;
for(;a;printf("%d ", a--);
}
-
What will be the output of given program?
#include<stdio.h>
void main()
{
int i=1, j=-1;
if((printf("%d", i)) < (printf("%d", j)))
printf("%d", i);
else
printf("%d", j);
}
-
What will be the output of the following piece of code?
for(i = 0; i<10; i++);
printf("%d", i);
-
What will be the output of the following code?
#include
void main()
{
int s=0;
while(s++<10)
{
if(s<4 && s<9)
continue;
printf("%dt", s);
}
}
- Which command is used to skip the rest of a loop and carry on from the top of the loop again?
#include<stdio.h>
int c[10] = {1,2,3,4,5,6,7,8,9,10};
main()
{
int a, b=0;
for(a=0;a<10;++a)
if(c[a]%2 == 1)
b+=c[a];
printf("%d", b);
}
for(i=10; i++; i<15)
printf("%d ", i);
for(k = 2, k <=12, k++)