R4R
Right Place For Right Person TM
 
R4R C C ExamplesPrint Number Triangle in C
previous

Home

Next

Learn C with example

 

Print Number Triangle Using C

In this example we are going to make a program by which we can Print numeric Triangle.

In this example we are going to print 1 in first line, 2 2 in second line 3 3 3 in third line ,and so on...

 

 

Source Code Of the Example

/* 1
   2 2
   3 3 3
   4 4 4 4
   5 5 5 5 5 */
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n;
clrscr();
printf("Enter a number\t");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
printf("%d",i);
printf("\n");
}
getch();
}

Output Of Example

Enter a number 5

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

previous

Home

Next


Tolal:0 Click:
Show All Comments

Post Your Comments

Your Name:

Your Email ID :
Comments :
URL
  =* Enter SUM

Tutorials,Examples,Questions and Answer

R4R
R4R
R4R
R4R
R4R
R4R
R4R
R4R