how to write a cprogram yo get output in the form
*
***
*****
*******
*********
*******
*****
***
*
Answer Posted / arka bandyopadhyay
#include<stdio.h>
#include<conio.h>
void main()
{ int i,j,k,a=4;
k=1;
clrscr();
printf("\n");
for(i=8;i>=0;i--)
{
for(j=0;j<=8 ;j++)
{
if(i>=4)
{
if(j<a ||j>(9-a-1) )
printf(" ");
else
printf(" *");
}
else
{
if(j>(8-k)||j< k)
printf(" ");
else
printf(" *");
}
}
--a;
if(i<4)k++;
printf("\n");
}
getch();
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What are the advantages and disadvantages of a heap?
Is a pointer a kind of array?
Do you know the difference between malloc() and calloc() function?
What is storage class?
How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?
What is difference between structure and union?
How do I swap bytes?
What is the importance of c in your views?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
State the difference between x3 and x[3].
how do you programme Carrier Sense Multiple Access
Do you know what are bitwise shift operators in c programming?
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.
How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.