program to print this triangle
*
* *
* * *

Answer Posted / prasenjit roy

void DrawStar(int Count)
{
int i,j;
for ( i = 1; i<=Count; i++ )
{
for ( j = i; j<Count ; j++ )
printf(" ");
for ( j = 1; j<=i; j++ )
printf("* ");
printf("\n");
}

}

int main(int argc, char* argv[])
{
DrawStar(3);
return 0;
}

Is This Answer Correct ?    40 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is null pointer and void pointer and what is their use?

820


What is the C-style character string?

807


How a new element can be added or pushed in a stack?

781


How one would use switch in a program?

817


What is istream and ostream in c++?

799


What is the difference between a baller and a reference in C++?

788


Why is "using namespace std;" considered bad practice?

835


What is abstraction with real time example?

866


What is the role of copy constructor in copying of thrown objects?

802


How can virtual functions in c++ be implemented?

818


Which bitwise operator is used to check whether a particular bit is on or off?

796


What is the difference between ++ count and count ++?

820


What is the difference between the functions memmove() and memcpy()?

855


What does iomanip mean in c++?

858


What do you mean by “this” pointer?

795