Code to produce increasing and decreasing stars
#include<iostream.h>
#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