Help me in this C program!

hussanali

Distinguished
Feb 6, 2008
3
0
18,510
Can somebody please write this program in C language!
2a0gk06.png
 

dickysolo

Distinguished
Oct 10, 2010
32
0
18,590


@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


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
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();
}