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
How is a structure member accessed?
Describe dynamic data structure in c programming language?
How do I get a null pointer in my programs?
What is a program flowchart?
What is a pointer in c?
What are the ways to a null pointer can use in c programming language?
What are the different types of linkage exist in c?
why programs in c are running with out #include
What is the difference between array and pointer?
Explain pointer. What are function pointers in C?
What is auto keyword in c?
Was 2000 a leap year?
Explain what happens if you free a pointer twice?
Explain how can I remove the trailing spaces from a string?
How to find a missed value, if you want to store 100 values in a 99 sized array?