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
Can you please compare array with pointer?
Explain what is wrong with this program statement?
pierrot's divisor program using c or c++ code
What are valid signatures for the Main function?
What is the difference between functions abs() and fabs()?
any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above
What is declaration and definition in c?
what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values
What is the use of in c?
Is c high or low level?
what are # pragma staments?
What is pointer in c?
What is the difference between NULL and NUL?
What is const and volatile in c?
What are loops in c?