BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan

BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan (http://bzupages.com/)
-   Object Oriented Programming (http://bzupages.com/300-object-oriented-programming/)
-   -   A Program that makes a Diamond Pattern Stars in the output. (http://bzupages.com/f300/program-makes-diamond-pattern-stars-output-15887/)

JuNaiDiQbaL 06-05-2011 03:45 PM

A Program that makes a Diamond Pattern Stars in the output.
 
#include
#include
void main()
{

int a,b,c,i,j,k,n;

clrscr();

cout<<"enter the value of n\n";

cin>>n;

//for the first half of diamond

for(i=n;i>0;i--)
{
for(j=1;j {
cout<<" ";
}
for(k=j-1;k {
cout"*";
cout<<" ";
}
cout<<"\n";
}


//for the second half of diamond

for(a=n-1;a {
for(b=n;b>a;b--)
{
cout<<" ";
}
for(c=0;c {
cout<<"*";
cout<<" ";
}
cout<<"\n";
}

getch();
}


All times are GMT +5. The time now is 02:51 AM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.