For programmers, testers and tech geeks

create diamond shape using nested loop in C++

#include<iostream>
#include<conio.h>
using namespace std;
void main()
{
int i,j,k;
for(i=1;i<=5;i++)
{
for(j=5;j>i;j--)
cout<<" ";
for(k=1;k<2*i;k++)
cout<<"*";
cout<<endl;
}
int m,n,v;
for(m=4;m>=1;m--)
{
for(n=5;n>m;n--)
cout<<" ";
for(v=1;v<2*m;v++)
cout<<"*";
cout<<endl;
}
getch();
}