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
What is meant by realloc()?
What functions are used for dynamic memory allocation in c language?
diff between exptected result and requirement?
How can I recover the file name given an open stream or file descriptor?
What are the advantages and disadvantages of c language?
What is the hardest programming language?
What is wild pointer in c with example?
List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.
What are the preprocessor categories?
explain what are actual arguments?
What is the scope of an external variable in c?
What are multidimensional arrays?
How can I make it pause before closing the program output window?
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
Why static variable is used in c?