• Check out all the best Amazon Prime Day deals 2021 here!

Help me in this C program!

dickysolo

Distinguished
Oct 10, 2010
32
0
18,590
4


@hussanali

this code is incomplete, some of the alphabets loop needs modification ....though I think you can continue from here...will update if I got it in the meantime....

first run this and check the result....trying C++ again after leaving college 7 years back....so :D

#include<iostream.h>
#include<conio.h>

int main()
{
int i,j,k,l;
char letter;
cout << "enter";
cin >> l;
cout << "\n";
for(i=1, letter='A';i<=l;i++,letter++)
{
for(j=l;j>=i;j--)
{
cout << "!";
}
cout <<letter;
cout << "\n";
}
return 0;
}
 

theDanijel

Distinguished
May 4, 2011
74
0
18,590
3


First of all it has to be a C program (printf instead of cout).
And the most important point to make here is to let the kid do his own homework and maybe learn something.
@hussanali, like in the code above, use a loop (for or while, I have no idea what chapter you're on) and be careful about how you print the characters.
 

magnus71

Honorable
Jul 1, 2012
16
0
10,560
0
try this, its in c++. convert the couts and cins-
#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
int i,x,y;
char j;
for(i=6;i>=0;i--)
{
for(x=0;x<i;x++)
cout<<"!";
for(y=x,j='A';y<6;y++,j++)
cout<<j;
cout<<endl;
}
getch();
}
 
Thread starter Similar threads Forum Replies Date
aymen9309 Apps General Discussion 1
SyndiShanX Apps General Discussion 1
D Apps General Discussion 1
BlueMoon1890 Apps General Discussion 0
Neon The (Anthro) Umbreon Apps General Discussion 1
K Apps General Discussion 2
T Apps General Discussion 10
M Apps General Discussion 2
R Apps General Discussion 3
S Apps General Discussion 2
N Apps General Discussion 1
P Apps General Discussion 4
A Apps General Discussion 8
M Apps General Discussion 6
S Apps General Discussion 1
convaallaria Apps General Discussion 5
H Apps General Discussion 3
A Apps General Discussion 1
U Apps General Discussion 1
F Apps General Discussion 3

ASK THE COMMUNITY