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
Write a Program to accept different goods with the number, price and date of purchase and display them
WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..
What are formal parameters?
What are static variables in c?
What is the value of a[3] if integer a[] = {5,4,3,2,1}?
Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?
Can we initialize extern variable in c?
Explain what’s a signal? Explain what do I use signals for?
What are the features of c languages?
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
What is equivalent to ++i+++j?
Explain pointer. What are function pointers in C?
Is void a keyword in c?
How do I send escape sequences to control a terminal or other device?
What is output redirection?