Friday, November 23, 2012

WRITE A CPROGRAM TO GENERATE THE FOLLOWING OUT PUT


/* WRITE A CPROGRAM TO GENERATE THE FOLLOWING OUT PUT:

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

*/

#include<stdio.h>
#include<conio.h>

#define MAXLINE 4

void main()
{
            int linenum=1,count=1,i=1;
            clrscr();
            while(linenum <= MAXLINE)
            {
                        for(count=1 ; count<=linenum ; i++)
                        {
                                    printf("%d\t",i);
                                    count++;
                        }
                        printf("\n");
                        linenum++;
            }
            getch();
}

/*
            =====OUT PUT=====

1
2       3
4       5       6
7       8       9       10

*/



0 comments:

Post a Comment