Monday 20 October 2014

C program to Print the following Output

1 2 3 4 5 6 7 7 7 8 9 10

Program:

#include<stdio.h>
#include<conio.h>
void main( )
{
          int i,j;
          for(i=1;i<=10;i++)
          {
                     if(i==7)
                     {
                              for(j=1;j<=3;j++)
                              {
                                          printf("%d  ",i);
                               }
                       }
                       printf("%d  ",i);
            }
}


Input/Output:

1 2 3 4 5 6 7 7 7 8 9 10



0 comments:

Post a Comment