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

If jack lies on Mon, Tue Wed and jill lies on Thursday, Friday and Saturday. If both together tell they lied yesterday. So c the given options and then c cos in the given dates one will be saying the truth and one will be lying. I got Thursday as option because jack is saying the truth he lied yest but jill is lying again as he lies on that day.

1785


What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.

1781


write a c program in such a way that if we enter the today date the output should be next day's date.

1677


What does *p++ do?

581


Explain how can I convert a number to a string?

640






How do I swap bytes?

626


Badboy is defined who has ALL the following properties: Does not have a girlfriend and is not married. He is not more than 23 years old. The middle name should be "Singh" The last name should have more than 4 characters. The character 'a' should appear in the last name at least two times. The name of one of his brothers should be "Ram" Write a method: boolean isBadBoy(boolean hasGirlFriend , boolean isMarried, int age , String middleName , String lastName , String[] brotherName); isHaveGirlFriend is true if the person has a girlfriend isMarried is true if the person is married age is the age of the person middleName is the middle name of the person lastName is the last name of the person brotherName is the array of the names of his brothers

1420


what are non standard function in c

1431


Where we use clrscr in c?

696


What is string constants?

657


How is pointer initialized in c?

581


how to print the character with maximum occurence and print that number of occurence too in a string given ?

2029


Why static variable is used in c?

548


What are variables and it what way is it different from constants?

782


Why do we use return in c?

563