Logo 
Search:

C Programming Articles

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

Program to print triangle in opposite pattern

Posted By: Reuben Brown     Category: C Programming     Views: 11854

Program to print triangle in opposite pattern

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

Code for Program to print triangle in opposite 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=1;i<=n;i++)
{
    printf("\n");
    for(k=1;k<=2*m-1;k++)
    {
    printf(" ");
    }
    for(j=1;j<=i;j++)
    {
     printf(" *");
    }


    m--;
}
getch();
}

/*
********
OUTPUT
********

Enter the No :- 5

*
* *
* * *
* * * *
* * * * *
*/
  
Share: 


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

Reuben Brown
Reuben Brown author of Program to print triangle in opposite pattern is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

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

 
Sathvik Patel from India Comment on: Aug 23
how to print the following output:
sssss1
ssss53
sss531
ss1531
s53153
531531
*s is for space*

Sathvik Patel from India Comment on: Aug 23
how to print the following output:
1
53
1531
53153
531531

View All Comments