C++ code to display filled isosceles triangle using for loop and asterisk character

C++ code to display filled isosceles triangle using for loop and asterisk character
Di Posting Oleh : Simple Learning
Kategori : asterisk cpp code isosceles shape triangle using nested for loop

Write a program which draw isosceles Triangle Shape with asterisk(*) and using nested for loop
 Program required output:

display  isosceles triangle using for loop and asterisk character




C++ Code:


#include<iostream>
using namespace std;

int main()
{

  int e=1;

  cout<<"\" Triangle Shape SHAPE \":\n\n";

  for(int a=1;a<=5;a++)
 {
    for(int b=4;b>=a;b--)
   {
    cout<<" ";  // Printing Space Here
   }
      for(int c=0;c<e;c++)
     {
       cout<<"*";  // Printing asterisk here
     }
      cout<<endl;   // new line
      e=e+2;
 }
}



Program Output:
sample output filled isosceles triangle asterisk character




More C++ Shapes Here


These kind of programs are very helpful in the understanding of nested for loop.

0 Response to "C++ code to display filled isosceles triangle using for loop and asterisk character"

Post a Comment