0% found this document useful (0 votes)
33 views5 pages

#Include #Include Void Main (CLRSCR For (Int I 1 I 3 I++) (For (Int J 1 J I J++) (Cout " " ) Cout Endl Endl ) Getch )

The document contains 4 C++ programs that use nested for loops to print out triangle patterns of asterisks. Each program prints a triangle with either increasing or decreasing number of asterisks on each line using loops and conditional statements.

Uploaded by

Angelica Cabrera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views5 pages

#Include #Include Void Main (CLRSCR For (Int I 1 I 3 I++) (For (Int J 1 J I J++) (Cout " " ) Cout Endl Endl ) Getch )

The document contains 4 C++ programs that use nested for loops to print out triangle patterns of asterisks. Each program prints a triangle with either increasing or decreasing number of asterisks on each line using loops and conditional statements.

Uploaded by

Angelica Cabrera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

*

**

***

#include<iostream.h>

#include<conio.h>

void main()

   clrscr();

   for(int i=1; i<=3; i++)

   {

      for(int j=1; j<=i; j++)

      {

cout<<"*";

      }

cout<<endl<<endl;

 }

   getch();

}
***

**

*
#include<iostream.h>

#include<conio.h>

void main()

   clrscr();

   for(int i=3; i>=1; i--)

   {

      for(int j=1; j<=i; j++)

      {

cout<<"*" ;

      }

cout<<endl<<endl;

   }

   getch();

}
*

**

***
#include<iostream.h>

#include<conio.h>

void main()

   clrscr();

   for(int i=1; i<=3; i++)

   {

      for(int k=3; k>i;  k--)

      {

      cout<<" ";

      }

      for(int j=1; j<=i; j++)

      {

cout<<"*";

      }

cout<<endl<<endl;

   }

   getch();

}
***

**

#include<iostream.h>

#include<conio.h>

void main()

   clrscr();

   for(int i=3; i>=1; i--)

   {

      for(int k=3; k>i;  k--)

      {

         cout<<" "; 

       }

      for(int j=1; j<=i; j++)

      {

cout<<"*";

      }

cout<<endl;

   }

   getch();

}
*

**

***

**

You might also like