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

Ascending Triangle Pattern

// Program to print an ascending triangle pattern

#include <iostream>

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

0 comments:

Post a Comment

Comment Here....