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


Please Help Members By Posting Answers For Below Questions

How is a structure member accessed?

585


Describe dynamic data structure in c programming language?

606


How do I get a null pointer in my programs?

621


What is a program flowchart?

605


What is a pointer in c?

684






What are the ways to a null pointer can use in c programming language?

592


What are the different types of linkage exist in c?

613


why programs in c are running with out #include? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

1317


What is the difference between array and pointer?

569


Explain pointer. What are function pointers in C?

628


What is auto keyword in c?

792


Was 2000 a leap year?

633


Explain what happens if you free a pointer twice?

614


Explain how can I remove the trailing spaces from a string?

625


How to find a missed value, if you want to store 100 values in a 99 sized array?

820