Write a program that accept one digit and display in triangle:
Example
input: 5
output
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
The C Program Is :
#include<stdio.h>
void main()
{
int i, n, j;
printf ("\n Please Enter Single Digit Number");
scanf("%d",&n);
for(i=1; i<=n; i++)
{
for(j=1; j<=i; j++)
printf("%d",j);
printf("\n");
}
}
Monday, 18 June 2012
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment