Saturday, July 24, 2021

Star Triangle Program

^^^^^^^^^^^^^Triangle Display^^^^^^^^^^^^^^^

*

*    *

*    *    *

*    *    *    *

*    *    *    *    *

---------------------------------------------------------------------------------

#include<stdio.h>

void main()

{

 int i,j;

 printf("Triangle Display \n");

 for(i=1;i<10;i++)

 {

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

   {   

      printf("*\t");

   }

  printf("\n");

 }

}

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

*    *    *    *    *

*    *    *    *

*    *    *

*    *

*

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#include<stdio.h>

void main()

{

 int n,i,j;

 clrscr();

 printf("Enter the no of lines required: \n");

 scanf("%d",&n);

 for(i=n;i>0;i--)

 {

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

   {

     printf("* \t");

   }

    printf("\n");

 }

}

No comments:

Post a Comment