Halo ladies and gentleman , i gt problem with this C program can help me ?

Status
Not open for further replies.

ImBeck

Right off the assembly line
Joined
Jul 9, 2008
Messages
2
Write a program that prompts the user for an integer and then displays a pyramid of this height made up of hash (#) on the screen.
A sample run is as follows:
How height would you like the pyramid to be? 8

#
# #
# # #
# # # #
# # # # #
# # # # # #
# # # # # # #
# # # # # # # #
 

krishnandu.sarkar

Simply a DIGITian
Staff member
Joined
Nov 13, 2007
Messages
4,671
Re: halo ladies n gentleman , i gt problem with this program can help me ?

hey dude..................u didn't mentioned the language...............I'm posting the coding for the program in C...........if the language differs then take the idea n logic frm this......

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,n;
printf("Enter the length : ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("\n");
for(j=1;j<=i;j++)
{
printf(" #");
}
}
getch();
}
 

utsav

damn busy...
Joined
Sep 10, 2006
Messages
1,956
Re: halo ladies n gentleman , i gt problem with this program can help me ?

Use nested loop. 2 loops will do the work .run the loop from 1 to n whr n is the integer inputted . Try to do the rest of the homework urself :neutral: btw u should have mentioned the language to be used . How can u expect an answer when u havnt properly mentioned the question
 

Ecko

Wandering In Tecno Land
Joined
Feb 17, 2005
Messages
722
/*
Program to demonstrate
*
**
***
****
*****
******
*/

#include <stdio.h>
#include <conio.h>
main()
{
int i,j;
for(i=1;i<=8;i++)
{
for(j=1;j<=i;j++)
printf("*");

printf("\n");
}
getch();
}

Replace Star with #
 

Faun

Wahahaha~!
Staff member
Joined
Dec 8, 2006
Messages
9,781
@OP
ask Master Chief and Covenants, they know the source code
though few floods may crept in as intermittent bigs during your playthrough.
 

nish_higher

Wise Old Owl
Joined
Jun 21, 2006
Messages
1,808
^ :D i thought its related to master chief.

i think this question was part of some company's exam?
 

QwertyManiac

Commander in Chief
Joined
Jul 17, 2005
Messages
6,575
Really? What kind of a company asks this? It must know that no one would be able to answer!
 
Joined
Sep 7, 2007
Messages
7,557
*i38.tinypic.com/2uiyhix.jpg

*gigasmilies.googlepages.com/24.gif

No offence meant!! Peace!!
*gigasmilies.googlepages.com/24.gifR*gigasmilies.googlepages.com/24.gifO*gigasmilies.googlepages.com/24.gifF*gigasmilies.googlepages.com/24.gifL*gigasmilies.googlepages.com/24.gif
 

Hitboxx

Juke Box Hero
Joined
Aug 18, 2007
Messages
1,198
Oh grow up guys! As smart as you all are, keep the fun where it is, don't mock new users.

Mass infractions issued on T159, QwertyManiac, nish_higher, abh1shek and MetalheadGautham :D
 

Hitboxx

Juke Box Hero
Joined
Aug 18, 2007
Messages
1,198
At ImBeck, posts such as this are considered homework and are not entertained here. Since your first time here I assume, this is ok. Next time, please refrain. Learning any language obviously requires research and logic of your own.

And also, when you put up a question on a public medium like a forum on the internet, try to form proper English sentences, else you have already seen here how things go ;)
 

Faun

Wahahaha~!
Staff member
Joined
Dec 8, 2006
Messages
9,781
stop being sorry ! you made someone smile...thats priceless
 
Joined
Sep 7, 2007
Messages
7,557
ya please accept my apologies too. I thought you were atleast entertained with this joke of ours, but I guess you took it too seriously. Have fun on this forum.
 

Hitboxx

Juke Box Hero
Joined
Aug 18, 2007
Messages
1,198
Heh, ok easy! There was a reason I put the smiley there. You're all forgiven except T159, His day will come :D

Thread won't serve anymore purpose. Closing!
 
Status
Not open for further replies.
Top