Diamond shape program of c++ using For loop

                                             

                        Diamond Shape Program using for Loop 

#include<iostream.h>
#include<conio.h>
int main()
{    cout<<"                C++ Program for Printing diamond shape"<<endl<<endl;
int a,b,c,d;
cout<<"enter your choice= ";
cin>>a;
for(b=0;b<=a;b++)
{
for(c=a-b;c>=0;c--)
cout<<" ";
for(d=1;d<=b;d++)
cout<<"* ";
cout<<"\n";
}
for(b=a;b>=0;b--)
{
for(c=a-b;c>=0;c--)
cout<<" ";
for(d=b;d>=1;d--)
cout<<"* ";
cout<<"\n";
}
getch();
}           

Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment

Powered by Blogger.

Translate

 
 
.