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 is c standard library?
write a program in c language to print your bio-data on the screen by using functions.
What does p mean in physics?
Explain the use of fflush() function?
What are the different types of control structures?
What are the different types of C instructions?
Write the control statements in C language
Why main is not a keyword in c?
How to write a code for reverse of string without using string functions?
What is the difference between the expression “++a” and “a++”?
Why is c fast?
Why do we use & in c?
What is data structure in c and its types?
Explain what are run-time errors?
Write a program to print factorial of given number without using recursion?