Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Does c have circular shift operators?

1183


What are register variables in c?

975


What is the purpose of the statement: strcat (S2, S1)?

1076


What is default value of global variable in c?

940


What is difference between structure and union in c programming?

1017


What are examples of structures?

1027


Explain how do you override a defined macro?

1020


Can you mix old-style and new-style function syntax?

1048


What is huge pointer in c?

1023


What are the modifiers available in c programming language?

1174


What are the different types of control structures?

986


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

943


What is null in c?

1006


What language is windows 1.0 written?

989


What is pass by reference in c?

1146