C programme to print following:-
*
* *
* * *
* * * *
#include<stdio.h>
#include<conio.h>
void main()
{
int r,c,k;
clrscr();
printf("\n");
for(r=0;r<5;r++)
{
for(c=0;c<5-r;c++)
{
printf(" ");
}
for(k=0;k<=r;k++)
{
printf("*");
printf(" ");
}
printf("\n");
}
getch();
}
*
* *
* * *
* * * *
#include<stdio.h>
#include<conio.h>
void main()
{
int r,c,k;
clrscr();
printf("\n");
for(r=0;r<5;r++)
{
for(c=0;c<5-r;c++)
{
printf(" ");
}
for(k=0;k<=r;k++)
{
printf("*");
printf(" ");
}
printf("\n");
}
getch();
}
No comments:
Post a Comment