Pages

How to make diamond in C++. Size of diamond is depend upon user ??

Thursday, 13 March 2014

How to make diamond in C++. Size of diamond is depend upon user ??

#include<iostream>
#include<conio.h>
using namespace std;
main()

{
int size;
cout<<"how large u want.. ";
cin>>size;
for(int i=1;i<=size;i++)
{for(int j=size;j>=i;j--)
cout<<" ";
for(int j=1;j<=i;j++)
cout<<"* ";
cout<<"\n";}

for( int i=size;i>=1;i--)
{for( int j=size;j>=i;j--)
cout<<" ";
for(int j=1;j<=i;j++)
cout<<"* ";
cout<<"\n";}

getch();

}
 

Search Box

Most Reading

Contact Form

Name

Email *

Message *