## 9.03.2011

### 17. Design numbers tringle pyramid

Q. Write a program to generate a following numbers triangle:(Where user entered number through keyboard, for example if num=5)
 1 1 2 1 1 2 3 2 1 1 2 3 4 3 2 1 1 2 3 4 5 4 3 2 1

Ans.
/*c program for number triangle pyramid*/

#include<stdio.h>
#include<conio.h>
int main()
{
int num,r,c,sp,x;
printf("Enter loop repeat number(rows):");
scanf("%d",&num);
for(r=1; num>=r; r++)
{
for(sp=num-r; sp>=1; sp--)
printf(" ");
for(c=1; c<=r; c++)
printf("%d",c);
for(x=r-1; x>=1; x--)
printf("%d",x);
printf("\n");
}
getch();
return 0;
}
/****************OUTPUT***************
Enter loop repeat number(rows): 5

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

**************************************/

1. #include
#include

main()
{
int i,j,n=10,y,z=1;
for(i=0;i<=n;i++)
{
for(j=n;j>0;j--)
{
printf(" ");
}
for(y=0;y<z;y++)
{
printf("*");
}
n--;
z=y+2;
printf("\n");
}

}

2. plz post algorithm of dis progm

3. can you give me the control flow of this program??

4. can ur gud slf plz give the code for
1
232
34543
4567654
567898765
4567654
34543
232
1

5. Hi Shahid,

Here is the code for your Pattern.

#include
int main()
{
int n=5,i,j,k1,k2,c,c1=0;

//Code for Upper Traingle
for(i=1;i<=n;i++)
{
k1=i-1;
c=0;

for(j=1;j<=i;j++) {
printf("%3d",++k1);
++c;
}

for(;c>1;c--)
printf("%3d",--k1);

printf("\n");
}

//Code for Bottom reverse Traingle
--i;
for(;i>=1;i--)
{
k2=i-1;
c=0;
for(j=1;j1;c--)
printf("%3d",--k2);

printf("\n");
}

return 0;
}

6. Can anyone give code for this pattern:

0
101
21012
3210123
432101234
54321012345

1. @Monica,

Your required above Number Triangle Pattern C program source code at:

http://cprogrammingcodes.blogspot.com/2014/08/number-triangle-pattern-c-program.html

2. Hy Monika how to I print numerical pyramid in

7. Can anyone give code for this pattern:

.....1*1
....2****2
...3******3
..4********4
5**********5
..4********4
...3******3
....2****2
......1*1

1. @Sudhanshu Sharma,

Your required number rhombus pattern C program source code at:

http://cprogrammingcodes.blogspot.com/2014/08/how-to-design-number-rhombus-pattern-c.html

8. can anyone give me code for following pattern??
###1###
##121##
#13331#
1444441
(# reprents blank space)

1. int n = 5;

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

for(int j=n-i; j>=0; j--){

System.out.print(" ");
}

for(int k = 0; k<(i*2)-1;k++){

if(k==0){

System.out.print(initial);

} else if( k==(i*2)-2){

System.out.print(initial);

} else {

System.out.print(i);
}

}
System.out.println();

}

9. 1
2 4 6
1 3 5 7 9
2 4 6 8 10 12 14
1 3 5 7 9 11 13 15 17

1. @Cyber Hacker,

Your required Odd and Even number pattern program in C as:

http://goo.gl/Xr39qb

10. I need help with the following pattern:
A
ABA
ABCBA
ABCDCDA
ABCDEDCBA
The pattern should extend to the character entered.
For example, the preceding pattern would result from an input value of E.

1. #Gabriela Espino

Your character triangle pattern C program source code as:

http://cprogrammingcodes.blogspot.com/2014/02/character-pyramid.html

11. Example

If input is 2, output will be

00006
00028 00066

If input is 3, output will be

00006
00028 00066
00120 00190 00276
provide code for this output

12. Code this pyramid plz.
0
1 0 1
2 1 0 1 2
3 2 1 0 1 2 3
4 3 2 1 0 1 2 3 4

13. Code for this pyramid plz
0
1 0 1
2 1 0 1 2
3 2 1 0 1 2 3
4 3 2 1 0 1 2 3 4

1. Reks Singh

Your number pattern C program source code at:
https://cprogrammingcodes.blogspot.in/2014/08/number-triangle-pattern-c-program.html

14. 0
101
21012
3210123 plse give me answer for c++

1. #Tarunendra Patel,

your required number triangle pattern program source code at:

https://goo.gl/FgPph5

15. what would be the code for the pattern :

***0***
**101**
*21012*
3210123

(Here * are nothing but the blank spaces . . .)

16. Please give me code for
1
121
13331
1444441