program to print this triangle
*
* *
* * *

Answer Posted / mayank murari

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k;
for(i=1;i<4;i++)
{
for(j=4;j>=i;j--)
{
printf(" ");
}
for(k=1;k<2*i;k++)
{
printf("*");
}
printf("\n");
}

getch();
}

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What data encapsulation is in c++?

592


How to access a variable of the structure?

583


What are dynamic type checking?

612


Can I learn c++ in a week?

576


What is the use of ::(scope resolution operator)?

646






How do you write a function that can reverse a linked-list?

572


How to declare a function pointer?

575


Write a program using shift_half( ) function to shift the elements of first half array to second half and vice versa.

787


What are stacks? Give an example where they are useful.

590


Explain unexpected() function?

582


What is the difference between a type-specific template friend class and a general template friend class?

552


What is the history of c++?

555


What is operator overloading in c++ example?

648


What do you mean by a template?

619


Describe private, protected and public – the differences and give examples.

583