Monday, 24 December 2012

A simple star printing program #3

That's the code for another simple star(*)  printing program:


#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,l;
clrscr;
printf("enter how many rows:");
scanf("%d",&k);
for(i=1;i<=k;i++)
{
for(j=1;j<=k-i;j++)
{
printf(" ");
}
for(l=1;l<=i;l++)
{
printf("* ");
}
printf("\n");
}
getch();
}

and the output is like:

0 Responses to “A simple star printing program #3”

Post a Comment

Recent Comments

All Rights Reserved Assignments on C language