WRITE A C PROGRAM FOR PRINT "RHOMBUS" STRUCTURE .
Example:
Enter the numbers :3
*
* *
* *
* *
*

Answer Posted / sagarsp2010

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,n;
clrscr();

printf("\nEnter the No. :");
scanf("%d",&n);

for(i=1;i<=n+(n-1);i++)
{
for(j=1;j<=n+(n-1);j++)
{
if(i+j==(n+1) || i+j==(n+n+n-1) || i-j==(n-
1) || i-j==-(n-1))
printf("*");
else
printf(" ");
}
printf("\n");
}
getch();
}

Is This Answer Correct ?    14 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is meant by realloc()?

670


What functions are used for dynamic memory allocation in c language?

597


diff between exptected result and requirement?

1592


How can I recover the file name given an open stream or file descriptor?

590


What are the advantages and disadvantages of c language?

556






What is the hardest programming language?

663


What is wild pointer in c with example?

570


List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.

2300


What are the preprocessor categories?

635


explain what are actual arguments?

630


What is the scope of an external variable in c?

563


What are multidimensional arrays?

656


How can I make it pause before closing the program output window?

576


int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above

741


Why static variable is used in c?

548