FY_BCA_C_SLIP_19



/* Slip no : 19_1 write prog to generate following pattern for  n lines
1
3              5
7              9              11
*/

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

int main()
{              int n,i,j,sum;
                printf("\n Enter no of lines : ");
                scanf("%d",&n);
                sum=1;
                for(i=1;i<=n;i++)
                {
                                for(j=1;j<=i;j++)
                                {
                                                printf("%d \t",sum);
                                                sum=sum+2;
                                }
                                printf("\n");
                }
                getch();
}

No comments:

Post a Comment