C loops and Conditional statements | Q - 11

Last Updated :
Discuss
Comments

What will be the outpu tof the following program?

C
# include <stdio.h>
int main()
{
   int i = 0;
   for (i=0; i<20; i++)
   {
     switch(i)
     {
       case 0:
         i += 5;
       case 1:
         i += 2;
       case 5:
         i += 5;
       default:
         i += 4;
         break;
     }
     printf("%d  ", i);
   }
   return 0;
}


5 10 15 20

7 12 17 22

16 21

Compiler Error

Tags:
Share your thoughts in the comments