^^^^^ Number Triangle Display ^^^^^
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
---------------------------------------------------------------------------------
#include<stdio.h>
void main()
{
int i,j;
printf("Triangle Display \n");
for(i=1;i<10;i++)
{
for(j=1;j<=i;j++)
{
printf("%d\t",j);
}
printf("\n");
}
}
*************************************************
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
**************************************************
#include<stdio.h>
void main()
{
int n,i,j;
clrscr();
printf("Enter the no of lines required: \n");
scanf("%d",&n);
for(i=n;i>0;i--)
{
for(j=1;j<=i;j++)
{
printf("%d\t",j);
}
printf("\n");
}
}
No comments:
Post a Comment