Tuesday, 23 April 2013

Code to produce increasing and decreasing stars

Description:

This program produce increasing and decreasing stars automatically.

Code:


#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
    int i,j;
    for(i=1;i<=9;i=i+2)
     {
        for(j=0;j<i;j++)
        cout<<"*";
        cout<<endl;
        }
         if(i==11)
         {i=i-4;
         for(i=7;i>=1;i=i-2)
          {for(j=0;j<i;j++)
          {
            cout<<"*";
         
            }
            cout<<endl;}}
            getche();
 }


Output:


No comments:

Post a Comment