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

write a C program: To search a file any word which starts with ?a?. If the word following this ?a? starts with a vowel.Then replace this ?a? with ?a? with ?an?. redirect with the output onto an output file.The source file and destination file are specified by the user int the command line.

2457


What are the types of c language?

561


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

1533


What are the disadvantages of a shell structure?

697


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

1675






What is file in c preprocessor?

658


Define macros.

787


Can you please explain the difference between exit() and _exit() function?

598


What is a null string in c?

593


What is a class c rental property?

620


How can I do peek and poke in c?

623


How do you use a 'Local Block'?

728


Define C in your own Language.

644


Is fortran still used today?

609


What would be an example of a structure analogous to structure c?

578