# C Program to Print Triangle of Numbers – Part 1

Write a program in the C programming language to print the triangle of numbers. Make a C program to print the following right angled triangle-

1
12
123
1234
12345
123456
1234567
12345678
123456789

Make this program by using the nested for loop. Below is the solution of the program.-

```void main()
{
int n, i;

for(i=1 ;i<=9; i++)
{
for(n=1; n<=i; n++)
{
printf("%d",n);
}
printf("\n");
}
getch();
}```

Output – Output of the program will be same as the triangle made above.

#### 18 thoughts on “C Program to Print Triangle of Numbers – Part 1”

1. karthika says:

1
2 3 4
5 6 7 8 9

1. sriram says:

#include
main()
{
int i,j,k,n;

printf(“Enter number of rows of the triangle \n”);
scanf(“%d”,&n);

for(i=1;i<=n;i++)
{

for(k=1;k<=(2*i)-1;k++)
{
j=i;
printf("%d",j);
j++;
}
printf("\n");
}
getch();
}

2. Ashok kumar srivastava says:

#include

int main()
{
int n, i, c, a = 1;

printf(“Enter the number of rows of Floyd’s triangle to print\n”);
scanf(“%d”, &n);

for (i = 1; i <= n; i++)
{
for (c = 1; c <= i; c++)
{
printf("%d ",a);
a++;
}
printf("\n");
}

return 0;
}

2. saroja says:

1
234
56789

3. saroja says:

_-1-_
_234_
56789

1. sravs says:

write a program using nested for loop to display
1
21
321
4321
54321

1. ensong says:

what the code of
1
21
321
4321
54321

4. aliza eshaal says:

i want program by output as 1 2 2 4 3 6 9
4 8 12
5 10 15

5. aliza eshaal says:

i want program by output as
1 2
2 4
3 6 9
4 8 12
5 10 15

6. aliza eshaal says:

please tell me how can i print these type of stars

*
* *
* * *
* *
*

7. lalaram says:

How to print thise
1
1 3
1 3 5
1 3 5 7
1 3 5
1 3
1

8. I want the program of output
1) *
**
***
****
*****
2) 12345
1234
123
12
1
3) 1
22
333
4444
55555

9. rohit says:

1 1
1 2 1 2
1 2 3 1 2 3
1 2 3 4 1 2 3 4

1. Latisha says:

PystyykÃ¶ ukkosen etÃ¤isyyden laskea laskemalla sekunteja vÃ¤lÃ¤hdyksestÃ¤ ja jakamalla sitten kolmella??eli jos vÃ¤lÃ¤htÃ¤Ã¤ ja siitÃ¤ noin 9 sekunnin pÃ¤Ã¤stÃ¤ kuuluu jyrinÃ¤ niin ukkonen on noin kolmen kilometrin pÃ¤Ã¤ssÃ¤…nÃ¤in joskus jostain opnsnkuulii..=)vi/siin valon nopeuteen 300000m/s liittyvÃ¤ juttu??

2. http://www./ says:

ã€€( 2012.03.6 17:48 ) : My partner and I stumbled over here different page and thought I may as well check things out. I like what I see so now i am following you. Look forward to checking out your web page for a second time.

3. I know how difficult this has been for you…and I know that the Lord fills our cups to overflowing because He wants us to rely on Him. With our mutual situations, we have to trust His sovereign plan for our families and rest in the comfort that He loves us and our children more than we can possibly comprehend. I’m praying for you! Drink fully and confidently and rest peacefully in His grace.

4. I didn’t know where to find this info then kaboom it was here.