*
***
*****
*******
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int n,r,a,p;
clrscr();
printf("enter the no of rows ");
scanf("%d",&n);
for(r=1;r<=n; r++)
{
for(p=n-r; p>=1; p--)
printf(" ");
for(a=r; a>=1; a--)
printf("*");
for(a=r; a>1; a--)
printf("*");
printf("\n");
}
getch();
}
#include<conio.h>
void main()
{
int n,r,a,p;
clrscr();
printf("enter the no of rows ");
scanf("%d",&n);
for(r=1;r<=n; r++)
{
for(p=n-r; p>=1; p--)
printf(" ");
for(a=r; a>=1; a--)
printf("*");
for(a=r; a>1; a--)
printf("*");
printf("\n");
}
getch();
}
Output:
No comments:
Post a Comment