C++ Program – Display Fun Stars

by Nideesh C on May 11, 2011 · 0 comments

in C++




//Downloaded From theonlinetutorials.com
//Source code
#include<iostream.h>
#include<conio.h>
int main()
 {
 int n,i,j;
 cout<<"Enter an integer value below 200 :";
 cin>>n;
 for(i=0;i<n;i++)
 {
 for( j=0;j<i;j++)
 cout<<" ";
 cout<<"*";
 for( j=1;j<=2*(n-i)-1;j++)
 {
 cout<<" ";
 }
 cout<<"*";
 cout<<endl;
 }
 for(j=0;j<i;j++)
 cout<<" ";
 cout<<"*"<<endl;
 for(i=n-1;i>=0;i--)
 {
 for( j=0;j<i;j++)
 cout<<" ";
 cout<<"*";
 for( j=1;j<=2*(n-i)-1;j++)
 {
 cout<<" ";
 }
 cout<<"*";
 cout<<endl;
 }
getch();
return 0;
 }



Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C++ Program – Display diamond and pascals triangle
  2. C Program – Print fun with pyramid
  3. C++ Program – Text file handling
  4. Sample – Program to draw circles.
  5. C++ Program – Matrix Manipulation

Leave a Comment

Previous post:

Next post: