Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

What is c standard library?

1146


write a program in c language to print your bio-data on the screen by using functions.

6733


What does p mean in physics?

989


Explain the use of fflush() function?

1025


What are the different types of control structures?

986


What are the different types of C instructions?

1245


Write the control statements in C language

1130


Why main is not a keyword in c?

1175


How to write a code for reverse of string without using string functions?

2075


What is the difference between the expression “++a” and “a++”?

1160


Why is c fast?

1009


Why do we use & in c?

950


What is data structure in c and its types?

1018


Explain what are run-time errors?

1038


Write a program to print factorial of given number without using recursion?

951