And what about the following pattern?
* * * * * * * * *
* * * * * * * *
* * * * * * *
* * * * * *
* * * * *
* * * *
* * *
* *
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
* * * * * * * *
* * * * * * * * *
Here is what you should write.
#include<stdio.h>
#include<conio.h>
int main()
{
int c,i,n;
printf("Enter a number: \n\n");
scanf("%d",&n);
clrscr();
for(i=n;i>=1;i--)
{
for(c=i;c>=1;c--)
{
printf("* ");
}
printf("\n\n");
}
for(i=1;i<=n;i++)
{
for(c=1;c<=i;c++)
{
printf("* ");
}
printf("\n\n");
}
getch();
return 0;
}
Ring a bell? ;)
No comments:
Post a Comment