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

When is a “switch” statement preferable over an “if” statement?

1138


Explain what math functions are available for integers? For floating point?

1107


What is a function in c?

1574


program to convert a integer to string in c language'

2453


"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above

1017


How do you declare a variable that will hold string values?

1172


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.

2069


What are the different file extensions involved when programming in C?

1252


Explain how do you determine a file’s attributes?

1042


Explain #pragma statements.

1044


Explain the difference between malloc() and calloc() function?

1042


What is auto keyword in c?

1206


What is strcmp in c?

1116


given post order,in order construct the corresponding binary tree

2779


What is ambagious result in C? explain with an example.

2626