Diamond Pattern Write a program that displays the following pattern

1
Diamond Pattern Write a program that displays the following pattern

LANGUAGE: C++

CHALLENGE: Diamond Pattern
Write a program that displays the following pattern:
*
***
*****
*******
*****
***
*
Output description: Seven lines of output as follows: The first consists of 3 spaces followed by a star. The second line consists of 2 spaces followed by a 3 stars. The third consists of one space followed by 5 stars, and the fourth consists just of 7 stars. The fifth line is identical to third, the sixth to the second and the seventh to the first.

SOLUTION:

#include <iostream>
using namespace std;

int main()
{
    cout << "   *\n"
    << "  ***\n"
    << " *****\n"
    << "*******\n"
    << " *****\n"
    << "  ***\n"
    << "   *\n\n";

   system("pause");

 return 0;
}



One comment

Add comment