Write a program that inputs the height of a triangle and display it using loop. For example if the user enters height as 5, the program should display the following.
#include <iostream.h>
#include <conio.h>
int main ()
{
int i , n , j;
cout<< "Please Give the value of N as height: " ;
cin>> n;
for (i = n; i > 0; i++)
{
for (j = n-i; j > 0; j--)
cout<<" ";
for (j = 2 * i-1; j > 0; j--)
cout<<"&";
cout<<"\n";
}
return 0;
}
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
Delete