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


Please Help Members By Posting Answers For Below Questions

Can two or more operators such as and be combined in a single line of program code?

813


What does struct node * mean?

605


void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }

1263


Which is the best website to learn c programming?

587


What is an identifier?

632






Differentiate call by value and call by reference?

571


What is "Duff's Device"?

705


FILE PROGRAMMING

1781


How can you determine the maximum value that a numeric variable can hold?

643


in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures

682


Explain what is the benefit of using const for declaring constants?

618


What is a pointer and how it is initialized?

613


What is pointers in c with example?

587


largest Of three Number using without if condition?

1012


What is the most efficient way to store flag values?

691