Thursday, 20 November 2014

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

Leave a Comment

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





Code:

#include<iostream>
using namespace std;
void main()
{
for(int i=0;i<5;i++)
{
for(int j=0;j<i;j++)
cout<<"*";
cout<<endl;
}
for(int i=4;i>=0;i--)
{
for(int j=0;j<i;j++)
cout<<"*";
cout<<endl;
}
system("pause");
}

Output


If You Enjoyed This, Take 5 Seconds To Share It