Monday 4 August 2014

A C language program to print Triangle of asterisks (*).


#include<stdio.h>
void draw_j(void);
void main()
{
          clrscr();
          draw_j();
          getch();
}
void draw_j(void)
{
          int a,s;
          for(a=5;a>=1;a--)
          {
          s=1;
          while (s<=a)
          {
          printf("*");
          s++;
          }
          printf("\n");
          }
}

OUTPUT:
********
*******
******
*****
****
***
**

*

No comments:

Post a Comment