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
When is a “switch” statement preferable over an “if” statement?
Explain what math functions are available for integers? For floating point?
What is a function in c?
program to convert a integer to string in c language'
"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above
How do you declare a variable that will hold string values?
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.
What are the different file extensions involved when programming in C?
Explain how do you determine a file’s attributes?
Explain #pragma statements.
Explain the difference between malloc() and calloc() function?
What is auto keyword in c?
What is strcmp in c?
given post order,in order construct the corresponding binary tree
What is ambagious result in C? explain with an example.