Wednesday, 29 October 2014

Draw triangle shape in C++ code in which user enter its desire size of triangle. Using nested for loop and asterisk

Leave a Comment












Code :-

#include <iostream>

using namespace std;

int main()
{
    int numb=0;
    cout<<"Enter Value for size of triangle : = ";
    cin>>numb;
    for(int i=0;i<numb;i++)
    {
        for(int b=numb;b>i;b--)
        {
            cout<<"*";
        }
        cout<<endl;
    }
    return 0;
}


Output


If You Enjoyed This, Take 5 Seconds To Share It