Write a program to give following output.....
*********
**** ****
*** ***
** **
* *
** **
*** ***
**** ****
*********

Answer Posted / vignesh1988i

#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);k++)
printf(" ");
for(j=n-i;j>=0;j--)
printf("*");
}
else
{
for(j=1;j<=(i-n+1);j++)
printf("*");
for(j=k-3;k<=(2*n-1);k++)
printf(" ");
for(j=i-n+1;j>0;j--)
printf("*");
}
}
getch();
}


i think this may work

thank u

Is This Answer Correct ?    4 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the benefit of using #define to declare a constant?

611


Write a program to print “hello world” without using semicolon?

679


Why dont c comments nest?

625


Is fortran still used today?

609


What are terms in math?

598






a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

881


When should a type cast not be used?

629


How do I copy files?

627


What is exit() function?

565


What's the total generic pointer type?

620


What is meant by keywords in c?

622


Why c is known as a mother language?

650


What is strcpy() function?

662


Compare array data type to pointer data type

603


What are the salient features of c languages?

627