Program to print a triangle
// Program to print a triangle
#include <iostream.h>
#include <conio.h>
main()
{
int n,m;
cout << "Enter the value of n : ";
cin >> n;
m = (2*n) - 1;
for (int i = 0; i < m; i++)
{
for (int j = 0; j <= i; j++)
{
cout << " * ";
}
cout << "\n";
}
getch();
}
Output :
No comments:
Post a Comment