hi every body im trying to write program on c++ to draw
_ _ _ 1
_ _ 212
_ 32123
4321234
"_" mean space
i tried to write it and i know the way that i need 3 for loop one for space and one for raws and other for columns and im going to use nested for but when i wrote my program it showed
_ _ _ 1
_ _ 222
_ 3333
444444
and this for i use in second draw :
for(int R=1 ; R%26lt;=4 ; R++)
{
for(int S=3 ; S%26gt;=R ; S--)
cout%26lt;%26lt;" "
for(int C=1 ; C%26lt;=2*R-1 ; C++)
cout%26lt;%26lt;R
cout%26lt;%26lt;endl
but i dont want that , i want the draw above
so can u help me plz
Please people help me with this c++ codes?
Dear,
Here is it:
_ _ _ 1
_ _ 212
_ 32123
4321234
int i,j;
for(i=1;i%26lt;=4;i++)
{
for(j=i;j%26lt;=3;j++)
cout%26lt;%26lt;" ";
for(j=i;j%26gt;=1;j--)
cout%26lt;%26lt;j;
if(i%26gt;1)
{
for(j=2;j%26lt;=i;j++)
cout%26lt;%26lt;j;
}
cout%26lt;%26lt;"\n";
}
OM NAMAH SHIVAY
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment