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-1;i++)
{
for(j=n-1;j>=i;j--)
{
if(i==j)
printf(" *");
else
printf(" ");
}
for(j=1;j<=n;j++)
{
if(i==j && i!=1 && i!=(n-(n-1)))
printf("*");
else if(j==2 || i==2)
printf(" ");
else
printf(" ");
}
printf("\n");
}
for(i=1;i<=n+1;i++)
{
for(j=1;j<=n;j++)
{
if(i==j)
printf("*");
else
printf(" ");
}
for(j=n-1;j>=i;j--)
{
if(i==j)
printf("*");
else
printf(" ");
}
printf("\n");
}
getch();
}
| Is This Answer Correct ? | 8 Yes | 5 No |
Post New Answer View All Answers
What are the disadvantages of external storage class?
p*=(++q)++*--p when p=q=1 while(q<=6)
The statement, int(*x[]) () what does in indicate?
given post order,in order construct the corresponding binary tree
What functions are used in dynamic memory allocation in c?
#include
Explain 'far' and 'near' pointers in c.
what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)
What language is c written?
Write a function that will take in a phone number and output all possible alphabetical combinations
Explain the use of function toupper() with and example code?
Differentiate between the = symbol and == symbol?
What is union and structure?
What is getch () for?
Why do we need arrays in c?