Tuesday, February 17, 2015

C program to print following trianlge using character

C program to print following trianlge using character *

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

void main()
{
int i,j,k,n;
clrscr(); //to clear the screen
printf("How many lines?");
scanf("%d",&n);

for(i=0;i<n;++i)
{
printf("
");

for(j=0;j<i;++j)
printf(" ");
for(k=n;k>i;--k)
printf("*");
}
getch(); //to stop the screen
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.