Learn C with example
Reverse Star Triangle
In this example we are going to print
reverse star triangle using C
In this example we are print *******..n in
first line,******..n-1 in second line,*******..n-2 in third line so on...
Source Code of the Example
/* Rreverse of triangle */
#include<stdio.h> /* * * * * * */
#include<conio.h> /* * * * * */
void main() /* * * * */
{ /* * * */
int i,j,n; /* * */
clrscr();
printf("Enter a number\t:");
scanf("%d",&n);
for(i=n;i>=1;i--)
{
for(j=1;j<=i;j++)
printf("*");
printf("\n");
}
getch();
}
|
Output Of Example
| Enter a number
:5 * * * * *
* * * *
* * *
* *
* |