Pyramid
Pyramid
*
***
*****
*******
*********
***********
Q.20 Write a C program to print Floyd's
triangle:
1
2 3
4 5 6
7 8 9 10
Q.21 Write a C program to print Pascal
triangle:
1
1 1
1 2 1
1 3 3 1
Q.22 Write a C program to print following
character triangle:
A
B B
C C C
D D D D
Q.23 Write a C program to print following
character triangle:
A
A B A
A B C B A
A B C D C B A
A B C D E D C B A
Q.24 Write a C program to print following
character triangle:
A B C D E D C B A
B C D E D C B
C D E D C
D E D
E
Q.25 Write a c program for following number
structure:
1
22
333
4444
55555
4444
333
22
1
I
IN
IND
INDI
INDIA
INDIA
INDI
IND
IN
I
1
21
321
4321
54321
54321
4321
321
21
1
Q.32 Write a C program to print the
following number pyramid:
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
6 6 6 6 6 6
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
A
BA
CBA
DCBA
EDCBA
DCBA
CBA
BA
A
EDCBA
DCBA
CBA
BA
A
9
0 1
2 3 4
5 6 7 8
9 0 1 2 3
Q. 44 Write a C program to print the
following number rectangle:
12344321
123__321
12____21
1______1
1
1 2 3
1 2 3 4 5
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8 9
123456654321
1234554321
12344321
123321
1221
11
1
222
33333
4444444
555555555
5
454
34543
2345432
123454321
Q. 52 Write a C program to print the
following star structure/fashion:
*********
*******
*****
***
*
***
*****
*******
*********
33333
32223
32123
32223
33333
*
**
* *
* *
* *
* *
* *
* *
* *
**********
*
***
******
**********
**** ****
*** ***
** **
* *
1
3 5 7
9 11 13 15 17 19
54321
5432
543
54
5
1
AB
123
ABCD
12345
1
2 3
4 5 6
7 8 9 10
1 2 3 4 5
2 3 4 5
3 4 5
4 5
5
A
BA
ABA
BABA
ABABA
*
**
***
****
***
**
*
1
232
34543
4567654
12321
12 21
1 1
12 21
12321
ABCBA
AB BA
A A
AB BA
ABCBA
*********
*******
*****
***
*
1234
2341
3412
4123
ABCD
BCDA
CDAB
DABC
1234
341
12
3
Q.71 Write a C program to print the
following character pyramid program:
ABCD
CDA
AB
C
1
2 3
4 5 6
7 8 9 1
2 3 4 5 6
1
123
12345
1234567
1333
2222
3331
1 a
21 ba
321 cba
4321 dcba
54321 edcba
1
01
010
1010
10101
1
01
101
0101
10101
******
* *
* *
******
1
*2
1*3
*2*4
1*3*5
1
A B
2 3 4
C D E F
5 6 7 8 9
98 comments:
1.
Hello sir, can u give me source code of the following program(i tried to write it,bt can't
do completed,,some error comming:
----1
---212
--32123
---212
----1
(single space=-)
write answer as soon as possible,,Thanks.
ReplyDelete
2.
@vk,I write your problem solution below, find out your error and enjoy programming
with C.
#include"stdio.h"
#include"conio.h"
void main()
{
int num=3,r=1,c,z,sp;
clrscr();
while(num>=r)
{
sp=num-r;
while(sp>=1)
{
printf(" ");
sp--;
}
c=r;
while(c>=1)
{
printf("%d",c);
c--;
}
z=2;
while(z<=r)
{
printf("%d",z);
z++;
}
printf("\n");
r++;
}
r=1;
while(num>=r)
{
sp=r;
while(sp>=1)
{
printf(" ");
sp--;
}
c=num-r;
while(c>=1)
{
printf("%d",c);
c--;
}
z=2;
while(z<=num-r)
{
printf("%d",z);
z++;
}
printf("\n");
r++;
}
getch();
}
Output:-
___1
__212
_32123
__212
___1
ReplyDelete
3.
gautam16 January 2012 16:22
ReplyDelete
Replies
1.
@Gautam, source code for your problem below. I also write it in above page for
easily readable.
Delete
Reply
4.
ReplyDelete
Replies
1.
http://cprogrammingcodes.blogspot.in/2012/06/pyramid-triangle.html
Delete
Reply
5.
ReplyDelete
Replies
1.
http://cprogrammingcodes.blogspot.in/2012/07/number-rectangle-structure.html
Delete
Reply
6.
To accept a string and display its only string stored in even position characters in c
language.
regards,
rajeev
[email protected]
ReplyDelete
Replies
1.
http://cprogrammingcodes.blogspot.in/2012/07/print-even-position-character.html
Delete
Reply
7.
ReplyDelete
Replies
1.
@py4408,
Your required source code at:
(I also add this program Q.62 )
http://www.cprogrammingcodes.blogspot.in/2012/11/character-pyramid_18.html
Delete
Reply
8.
A
aa
BBB
bbbb
CCCCC
cccc
DDD
dd
E
ReplyDelete
9.
9
898
78987
6789876
ReplyDelete
Replies
1.
http://www.cprogrammingcodes.blogspot.in/2012/09/number-triangle.html
Delete
Reply
10.
ReplyDelete
Replies
1.
@Gurpreet Singh,
http://www.cprogrammingcodes.blogspot.in/2012/09/star-triple-pyramid.html
Delete
Reply
11.
33333
32223
32123
32223
33333
ReplyDelete
Replies
1.
http://www.cprogrammingcodes.blogspot.in/2012/10/rectangle-number-
pyramid.html
Delete
Reply
12.
ReplyDelete
Replies
1.
http://www.cprogrammingcodes.blogspot.in/2012/10/odd-number-series-
pyramid.html
Delete
Reply
13.
54321
5432
543
54
5
ReplyDelete
Replies
1.
@Ritesh Roy,
Your required above number pyramid program source code at:
(I also add this program at Q.58)
http://cprogrammingcodes.blogspot.in/2012/10/number-pyramid.html
Delete
2.
main()
{
int n,i,j,c=1;
clrscr();
printf("Enter the number of rows u want\n");
scanf("%d",n);
for(i=n;i>=1;i--)
{
for(j=n; j>=c;j--)
{
printf("%d",j);
printf(" ");
}
c=c+1;
}
return 0;
getch();
}
please try this code i think it is work is there any problem
please reply me to this mail
Delete
Reply
14.
Sir,
Can you tell me how to create ?
1
AB
123
ABCD
12345
ReplyDelete
Replies
1.
@Smeet Maniar,
Your required character-number pyramid source code at:
(I also add this program Q.59)
http://cprogrammingcodes.blogspot.in/2012/11/number-character-pyramid.html
Delete
Reply
15.
Smeet Maniar2 November 2012 08:09
Consider it as a pyramid !
ReplyDelete
16.
1-2-3
-2-3
--3
ReplyDelete
Replies
1.
@Mohitthefuturemessi,
http://www.cprogrammingcodes.blogspot.in/2012/11/number-pyramid.html
Delete
Reply
17.
1--2--3
-1---2
---1
ReplyDelete
Replies
1.
@Mohitthefuturemessi,
http://cprogrammingcodes.blogspot.in/2012/11/number-pyramid_4.html
Delete
Reply
18.
how to make program if the user enter the number 3 print the form
*
**
*
and if the user enter the number 5 print the form
*
**
***
**
*
and if the user enter the number 7 print the form
*
**
***
****
***
**
*
ReplyDelete
Replies
1.
@semere mehari,
Your required program source code at:
(I also add this program Q.63 )
http://cprogrammingcodes.blogspot.in/2012/11/star-pyramid.html
Delete
Reply
19.
ABCBA
AB BA
AA
AB BA
ABCBA
ReplyDelete
Replies
1.
@Simarpreet Singh,
Your required program source code at:
(I also add this at Q.66)
http://cprogrammingcodes.blogspot.in/2012/12/character-rectangle-design.html
Delete
Reply
20.
ReplyDelete
21.
ReplyDelete
Replies
1.
@karthi keyan,
Your required program source code at:
(I also add this at Q.64)
http://www.cprogrammingcodes.blogspot.in/2012/12/number-triangle-
program.html
Delete
Reply
22.
ReplyDelete
Replies
1.
@Lochan sao,
Your required source code at:
(I also add this program at Q.67)
http://www.cprogrammingcodes.blogspot.in/2012/12/star-triangle-pyramid.html
Delete
Reply
23.
ABCD
CDA
AB
C
ReplyDelete
Replies
1.
@Dashami Umesh,
Your required source code at:
(I also add this program at Q.71)
http://www.cprogrammingcodes.blogspot.in/2012/12/character-pyramid-
program.html
Delete
Reply
24.
ReplyDelete
25.
ReplyDelete
26.
using function
1
23
456
7891
23456
ReplyDelete
Replies
1.
@Alj,
Your required source code of pyramid using function at:
(I also add this program at Q.72)
http://cprogrammingcodes.blogspot.in/2012/12/number-pryamid-by-function.html
Delete
Reply
27.
ReplyDelete
Replies
1.
@mani gandan,
Your required source code of number pyramid at:
(I also add this program at Q.73)
http://cprogrammingcodes.blogspot.in/2012/12/number-pyramid_17.html
Delete
Reply
28.
sree hari26 December 2012 18:01
ReplyDelete
Replies
1.
@Sree Hari,
Your required source code of number pyramid at:
(I also add this program at Q.74)
http://cprogrammingcodes.blogspot.in/2012/12/number-rectangle.html
Delete
Reply
29.
ReplyDelete
30.
1______a
21_____ba
321____cba
4321___dcba
54321__edcba
ReplyDelete
Replies
1.
@Kate,
Your required source code of number-character pyramid at:
(I also add this program at Q.75)
http://cprogrammingcodes.blogspot.in/2013/01/number-character-triangle.html
Delete
Reply
31.
ReplyDelete
Replies
1.
sivaji,
I little bit confuse,
How much stars you want to print? is number_of_stars is equal to
number_of_charater_in_name?
Explained your question.
Delete
Reply
32.
ReplyDelete
Replies
1.
@madhura naik,
Your required source code of number-character pyramid at:
(I also add this program at Q.77)
http://www.cprogrammingcodes.blogspot.in/2013/01/1-and-0-pyramid.html
Delete
Reply
33.
ReplyDelete
Replies
1.
void main(){
int i,j,n;
clrscr();
printf("enter the row size:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
printf("%3d",j+j-1);
printf("\n");
}
getch();
}
Delete
Reply
34.
Program for
0
101
21021
3210123
ReplyDelete
Replies
1.
http://cprogrammingcodes.blogspot.in/2013/04/odd-number-triangle_21.html
Delete
Reply
35.
program for
1
21A
321AB
4321ABC
54321ABCD
ReplyDelete
Replies
1.
@Jash Kothari,
http://cprogrammingcodes.blogspot.in/2013/04/number-character-triangle.html
Delete
Reply
36.
37.
DCBA
DCB
DC
B
ReplyDelete
Replies
1.
void main(){
int i,j,p;
clrscr();
for(i=1;i<=4;i++)
{
p=68;
for(j=4;j>=i;j--)
{
printf("%2c",p);
p--;
}
printf("\n");
}
getch();
}
Delete
Reply
38.
ReplyDelete
Replies
1.
void main(){
int i,j,p;
clrscr();
for(i=1;i<=3;i++)
{ p=65;
for(j=1;j<=i;j++)
{
printf("%2c",p);
p++;
}
printf("\n");
}
getch();
}
Delete
Reply
39.
1
121 1 121
12321 121 1 121 12321
ReplyDelete
40.
Pls Help
1
11
2222
333333
44444444
5555555555
Thnx in advance
ReplyDelete
Replies
1.
@Shivinder Chandok,
http://cprogrammingcodes.blogspot.in/2013/03/double-number-triangle.html
Delete
2.
void main()
{
int i,j,n;
clrscr();
printf("enter row size:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{ if(i<3)
printf("%3d",1);
else
for(j=1;j<i;j++)
printf("%3d%3d",i-1,i-1);
}
printf("\n");
}
getch();
}
Delete
Reply
41.
ReplyDelete
Replies
1.
void main(){
int i,j,n;
clrscr();
printf("enter the row size:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{ //if(j==5)
//printf(" ");
if(j<=i)
printf("%2d",9-j);
else
printf("%2d",8-(i-1));
}
printf("\n");
}
getch();
}
Delete
Reply
42.
- -1
-2 3 2
34543
Thanx in Adance
ReplyDelete
Replies
1.
@Ujaan Nandy,
http://cprogrammingcodes.blogspot.in/2013/03/static-number-pyramid.html
Delete
Reply
43.
ReplyDelete
44.
ReplyDelete
Replies
1.
@Anshul Chugh,
Delete
Reply
45.
*********
*******
*****
***
*
ReplyDelete
Replies
1.
@Jimish Shah,
http://cprogrammingcodes.blogspot.in/2013/04/simple-star-pyramid.html
Delete
Reply
46.
1
**
123
***
12345
*****
can u give me the code for following pattern in c lanuage
ReplyDelete
Replies
1.
@Ateet Mishra,
http://cprogrammingcodes.blogspot.in/2013/04/number-star-pyramid.html
Delete
Reply
47.
1
*2
1*3
*2*4
1*3*5
*2*4*6
can u give me the code for following pattern in c language only
ReplyDelete
Replies
1.
http://cprogrammingcodes.blogspot.in/2013/04/even-odd-number-star-
pyramid.html
Delete
Reply
48.
ReplyDelete
Replies
1.
@Ateet Mishra,
http://cprogrammingcodes.blogspot.in/2013/04/number-star-pyarmid.html
Delete
Reply
49.
UMER NAWAZ7 April 2013 16:13
****
***
**
*
**
***
****
ReplyDelete
Replies
1.
@UMER NAWAZ,
http://cprogrammingcodes.blogspot.in/2013/04/star-pyramid.html
Delete
Reply
50.
A
**
ABC
**
A
*
$$
***
$$$$
1
AB
234
CDEF
56789
0
-1 0 -1
-2 -1 0 -1 -2
-3 -2 -1 0 -1 -2 -3
ReplyDelete
Replies
1.
@Jannat Patel,
http://cprogrammingcodes.blogspot.in/2013/04/character-symbol-pyramid.html
http://cprogrammingcodes.blogspot.in/2013/04/differ-symbol-pyramid.html
http://cprogrammingcodes.blogspot.in/2013/04/continue-character-number-
pyramid.html
http://cprogrammingcodes.blogspot.in/2013/04/odd-number-triangle_21.html
Delete
Reply
51.
Arulanandasamy Viyagulasamy14 April 2013 01:43
10 9 8 7
456
32
1
i want a program for this output
ReplyDelete
Replies
1.
@Arulanandasamy Viyagulasamy,
http://cprogrammingcodes.blogspot.in/2013/04/reverse-number-pyramid.html
Delete
Reply
52.
code for
------------------*
-------------*--------*
---------* -------*------*
---- * -----*----------*------*
ReplyDelete
53.
ReplyDelete
Replies
1.
@Muhammad Shoaib,
http://cprogrammingcodes.blogspot.in/2013/04/odd-number-triangle.html
Delete
Reply
54.
Please do it:
1
23
456
7 8 9 10
11 12 13
14 15
16