Copyright © Programs ++
Design by Dzignine
Wednesday, 25 January 2012

Descending Triangle Pattern

// Program to print a descending triangle pattern

#include <iostream>

int main()
{
    char ch;
    int n,j,k;
    std::cout<<" Enter a character : ";
    std::cin>>ch;
    std::cout<<" Ener the no of lines to print : ";
    std::cin>>n;
    for (int i=1; i<=n; i++)
    {
        for (j=n; j>=i; j--)
            std::cout<<ch; // prints the specified character
       
        std::cout<<std::endl; // to leave a line space
    }
    std::cin.get(); // to display the output
    return 0;
} // end of main
Descending star pattern

0 comments:

Post a Comment

Comment Here....