Write a program to give following output.....
*********
**** ****
*** ***
** **
* *
** **
*** ***
**** ****
*********
Answer Posted / vignesh1988i
sorry i have done a small mistake ..... this is correct
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,j,k;
printf("enter the no. of lines :");
scanf("%d",&n);
for(i=1;i<=(n*2-1);i++)
{
if(!(i^1)|| !(i^(n*2-1)))
{
for(j=1;j<=(n*2-1);j++)
printf("*");
}
else
{
if(i<=n)
{
for(j=1;j<=n-i;j++)
printf("*");
for(k=1;k<(2*(i-1));k++)
printf(" ");
for(j=n-i;j>=0;j--)
printf("*");
if(i==n)
{
k--;
m=k;
}
}
else
{
for(j=1;j<=(i-n+1);j++)
printf("*");
for(j=k;k<=k-n-1;k++)
printf(" ");
k-=2;
for(j=i-n+1;j>0;j--)
printf("*");
}
}
getch();
}
| Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
Is a house a shell structure?
please help me..... please codes and flowchart plz turbo c lang po yan.....please asap response... 3. Make an astrology program. The user types in his or her birthday (month, day, and year as integer), and the program responds with the user’s zodiac sign, horoscope, and other information related to it. If the user’s birth year falls into a leap year, your program should display an appropriate message for it. NOTES: Conditional Statements: it should be with graphics
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
What is the difference between malloc() and calloc()?
In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none
What are the 4 types of programming language?
What is the use of void pointer and null pointer in c language?
Can you please explain the scope of static variables?
What is volatile variable in c?
How old is c programming language?
How was c created?
what is recursion in C
What are the main characteristics of c language describe the structure of ac program?
What is the explanation for the dangling pointer in c?
What are pointers really good for, anyway?