program to print triangle pattern
#include<stdio.h> main() { int i,j,n; printf("enter value for n\n"); scanf("%d",&n); for(i=n;i>0;i--) { for(j=1;j<=n;j++) { if(j<i) printf(" "); else printf("* "); } printf("\n"); } }OutPut:
madan@madan-Lenovo-G570:~/madan$ cc ex46.c madan@madan-Lenovo-G570:~/madan$ ./a.out enter value for n 5 * * * * * * * * * * * * * * *