Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to print triangle of * stars in reverse pattern

Posted By: Jawwad Akram     Category: C Programming     Views: 44568

Program to print triangle of * stars in reverse pattern


* * * * *
__* * * *
____* * *
______* *
________*

Code for Program to print triangle of * stars in reverse pattern in C Programming

#include <stdio.h>
#include <conio.h>
#include<math.h>


void main()
{
int n,i,j,m,k;
clrscr();
printf("Enter the No :- ");
scanf("%d",&n);

m=n;
for(i=n;i>=1;i--)
{
    printf("\n");


    for(k=1;k<=2*m-1;k++)
    {
    printf(" ");
    }
    for(j=i;j>=1;j--)
    {
     printf("* ");
    }


    m++;
}
getch();

}
/*
********
OUTPUT
********
Enter the No :- 6

* * * * * *
* * * * *
* * * *
* * *
* *
*

*/
  
Share: 


Didn't find what you were looking for? Find more on Program to print triangle of * stars in reverse pattern Or get search suggestion and latest updates.

Jawwad Akram
Jawwad Akram author of Program to print triangle of * stars in reverse pattern is from Hyderabad, Pakistan.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
Muneeb Ahmed from Pakistan Comment on: Apr 07
#include<stdio.h>
#include<conio.h>
void main(void)
{
int a,b,c,d=0,n;
scanf("%d",&n);
clrscr();
for(a=1;a<=n;a++)
{
for(b=n;b>=a;b--)
{
printf(" ");
}
for(c=1;c<=a+d;c++)
{
printf("*");

}
d++;
printf("\n");
}

getch();
}

View All Comments