Q:

Write a program in C++ to display the pattern like right angle triangle using an asterisk

0

Write a program in C++ to display the pattern like right angle triangle using an asterisk

Sample Output:

 display the pattern like right angle triangle using an asterisk:      
---------------------------------------------------------------------  
 Input number of rows: 5                                               
*                                                                      
**                                                                     
***                                                                    
****                                                                   
*****

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>
using namespace std;

int main()
{
   int i,j,rows;
    cout << "\n\n display the pattern like right angle triangle using an asterisk:\n";
    cout << "---------------------------------------------------------------------\n";
    cout << " Input number of rows: ";
    cin >> rows;
   for(i=1;i<=rows;i++)
   {
	for(j=1;j<=i;j++)
	   cout<<"*";
	cout<<endl;
   }	
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now