Question #284718

Write a C program that would generate the pattern below:

*

**

***

*****

******

*****

****

***

**

*


Expert's answer

#include <iostream>



int main(int argc, char* argv[])
{
    char c = '*';
    std::cout << c << std::endl;
    std::cout << c << c << std::endl;
    std::cout << c << c << c << std::endl;
    std::cout << c << c << c << c << c << std::endl;
    std::cout << c << c << c << c << c << c << std::endl;
    std::cout << c << c << c << c << c << std::endl;
    std::cout << c << c << c << std::endl;
    std::cout << c << c << std::endl;
    std::cout << c << std::endl;


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS