program to print this triangle
*
* *
* * *

Answer Posted / vivek kumar

#include <stdio.h>
#define MAX 6
int main()
{
int i, j,k;

for(i = 0; i < MAX; i++)
{
for(j = 0; j < MAX-1-i; j++)
printf("\t");
for(k = 0; k < i*2+1; k++)
printf("*\t");
printf("\n");
}
return 0;
}

Is This Answer Correct ?    11 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define a nested class. Explain how it can be useful.

632


Is c++ harder than java?

564


What is difference between c++ 11 and c++ 14?

572


Write a Program for find and replace a character in a string.

552


What are the various storage classes in C++?

644






What happens if a pointer is deleted twice?

785


When should we use container classes instead of arrays?

580


Why do we need c++?

593


How a macro differs from a template?

633


How do you define/declare constants in c++?

604


What is the use of string in c++?

545


What parameter does the constructor to an ofstream object take?

607


Why c++ is better than c language?

557


I was a c++ code and was asked to find out the bug in that. The bug was that he declared an object locally in a function and tried to return the pointer to that object. Since the object is local to the function, it no more exists after returning from the function. The pointer, therefore, is invalid outside.

605


what is c++

1795