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
void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }
What is the difference between break and continue?
What do you mean by dynamic memory allocation in c?
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
Who developed c language?
What is the use of header?
Define Spanning-Tree Protocol (STP)
What is the use of a semicolon (;) at the end of every program statement?
What are void pointers in c?
How is a macro different from a function?
What is the use of f in c?
In c programming, explain how do you insert quote characters (? And ?) Into the output screen?
how we can make 3d venturing graphics on outer interface
What are global variables and how do you declare them?
Is anything faster than c?