Thursday, 24 January 2013

diamond

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
int n = 7;
int m = 1;
int x = 6;


for (int i = 0; i < 3; i++)
{

    cout << setw(x);
  x--;


    for (int j = 0; j < m; j++)

     cout << "*";
        cout << endl;

        m=m+2;
        }



        for (int i = 0; i < 4; i++)
{

    cout << setw(x);
  x++;


    for (int j = 0; j < n; j++)

     cout << "*";
        cout << endl;

        n=n-2;
        }


cin.get();
return 0;
}

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Enterprise Project Management