adspace


WRITE A C PROGRAM FOR PRINT "RHOMBUS" STRUCTURE .
Example:
Enter the numbers :3
*
* *
* *
* *
*

Answer Posted / shakil ahmed

#include<stdio.h>
#include<conio.h>
main()
{
int i, j,s,si,n;
scanf("%d",&n);
s=n-1;
si=1;

for(i=1; i<=n-1; i++)
printf(" ");
printf("*\n");

for(i=1; i<=n-1; i++)
{
for(j=1; j<=s-1; j++)
printf(" ");
s--;
printf("*");
for(j=1; j<=si; j++)
printf(" ");
si+=2;
printf("*\n");
}

s=1;
si-=4;
for(i=1; i<=n-2; i++)
{
for(j=1; j<=s; j++)
printf(" ");
s++;
printf("*");
for(j=1;j<=si;j++)
printf(" ");
si-=2;
printf("*\n");
}

for(i=1; i<=n-1; i++)
printf(" ");
printf("*\n");
}

Is This Answer Correct ?    9 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.

2829


write a progrmm in c language take user interface generate table using for loop?

2124


write a c program to find the sum of five entered numbers using an array named number

2248


The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?

1361


will u please send me the placement papers to my mail???????????????????

1930


Can a function be forced to be inline? Also, give a comparison between inline function and the C macro?

1183


what is ur strangth & weekness

2592


How can I implement sets or arrays of bits?

1119


What are pointers? What are different types of pointers?

1266


i have a written test for microland please give me test pattern

2814


hi send me sample aptitude papers of cts?

2252


PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM

2260


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2740


What is dynamic dispatch in c++?

1140


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2516