Hello!
I have made a program that prints a diamond shape. But my program should read an odd number in the range 1 to 19 to specify the number of rows in the diamond, then it should display
a diamond of the appropriate side in which it is at present. I am a beginner. I don't know how to do that. Can any one help? I am in a need of it...!
#include <iostream.h>
#include <conio.h>
void main()
{
int i, j, k;
for(i=1; i<=5; i++)
{
for(j=1; j<=5-i; j++)
cout << " ";
for(k=1; k<=2*i-1; k++)
cout << "*";
cout << endl ;
}
int l,m,n;
for (n = 4; n > 0;n--)
{
for (l = 1; l <= 5- n; l++)
cout<<" ";
for (m = 1; m<= 2 * n- 1; m++)
cout<<"*";
cout<<endl;
}
getch();
}