-3

number of iterations in the following loop

main()
{ int x=5, y=10, z=9
   for (;x<=5;)
      {y++;z--;
        x=x+1/2;
        if(z==0) z=y;}}

Edited by Nick Evan: Added code-tags...

3
Contributors
7
Replies
8
Views
7 Years
Discussion Span
Last Post by Ancient Dragon
-2

What will be the output of the following code segment (assuming sizeof (int) returns 4)

int i= 0x1<<sizeof (int)*8-1;
printf("\n%x", i);
i=i>>sizeof(int)*8-1;
printf("%d",i);

Edited by WaltP: Added CODE Tags -- again

-2

Which one is the valid statement in C?
A)#define half(x) ((x/2.0)
B)#define STREQ(s1,s2) (strcmp((s1),(s2))==0);
C)#define MAX=5
D)#define INTEREST 5, LOAD 5000

-2

Choose the correct option to find maximum of the three interger variables.
A) (a>b)?((a>c)?a:c):((b>c)?b:c)
B)(a>b)?((b>c)?b:c):((a>c)?a:c)
C)(a>b)?((c>b)?a:c):((a>c)?a:c)
D) None

-2

What is the effect of the following code?

main() 
{
int option=4;
  switch(option/2)
      {
       case 1: printf("EAST");
       case 2: printf("WEST");
       case 3: printf("NORTH");
       case 4: printf("SOUTH");
      }
  }

Edited by WaltP: And again...

Votes + Comments
Do your own damn homework!
1

What is the effect of the following code?
main()
{
int option=4;
switch(option/2)
{
case 1: printf("EAST");
case 2: printf("WEST");
case 3: printf("NORTH");
case 4: printf("SOUTH");
}
}

Hint: there are no break statements between the cases.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.