program to print this triangle
*
* *
* * *

Answers were Sorted based on User's Feedback



program to print this triangle * * * * * *..

Answer / 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

program to print this triangle * * * * * *..

Answer / maria

void main()
{
int i , j , k ;
for(i = 0 ; i < 3 ; i++)
{
for (k = 2 ; k >= i ; k--)
{
printf (" ") ;
}
for(j = 0 ; j<= i ; j++)
{
printf ("* " , i , j) ;
}
printf ("\n") ;
}
}

Is This Answer Correct ?    33 Yes 13 No

program to print this triangle * * * * * *..

Answer / 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");
if(i == 0)
printf("*\t");
else
for(k = 0; k < i*2+1; k++)
printf("*\t");
printf("\n");
}
return 0;
}

Is This Answer Correct ?    12 Yes 5 No

program to print this triangle * * * * * *..

Answer / 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

program to print this triangle * * * * * *..

Answer / amit

/* Display Following Output
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
* * * * * * * * * * * */

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,r;
clrscr();

printf("\n\t Enter the raw number for Making Pyramind =>");
scanf("%d",&r);

printf("\n\n\n\n");

for(i=0;i<r;i++)
{
for(k=r;k>=i;k--)
{
printf(" ");
}
for(j=0;j<=i;j++)
{
printf(" *",i,j);
}
printf("\n");

}
getch();
}

Is This Answer Correct ?    12 Yes 7 No

program to print this triangle * * * * * *..

Answer / dhruv kaushal

//Made by- Dhruv Kaushal visit bestindiasongs.blogspot.com
//Programe starts from Next line

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,k,l;
for(i=1;i<=4;i++)
{
cout<<"\n";
for(j=4;j>=i;j--)

{
cout<<" ";
}
for(k=1;k<=i;k++)
{
cout<<"*";
}
for(l=2;l<=i;l++)
{
cout<<"*";
}
}
getch();
}

Is This Answer Correct ?    4 Yes 2 No

program to print this triangle * * * * * *..

Answer / 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

program to print this triangle * * * * * *..

Answer / vivek

!Program is executable in C++

#include<iostream.h>
#include<conio.h>
void main()
{
int i,j;
for(i=0;i<3;++i)
{
for(j=0;j<i;++j)
cout<<"* ";
cout<<"\n";
}
getch();
}

Is This Answer Correct ?    0 Yes 1 No

program to print this triangle * * * * * *..

Answer / saravana kumar

void main()
{
int i , j , k ;
for(i = 0 ; i < 3 ; i++)
{
for (k = 2 ; k >= i ; k--)
{
printf (" ") ;
}
for(j = 0 ; j<= i ; j++)
{
printf ("* " , i , j) ;
}
printf ("\n") ;
}

Is This Answer Correct ?    7 Yes 13 No

program to print this triangle * * * * * *..

Answer / roma

for(i=1; i<=3; i++)
{
cout<<"*"
}
getch();

Is This Answer Correct ?    4 Yes 11 No

Post New Answer

More C++ General Interview Questions

Define stacks. Provide an example where they are useful.

0 Answers  


Would you rather wait for quicksort, linear search, or bubble sort on a 200000 element array? (Or go to lunch...) a) Quicksort b) Linear Search c) Bubble Sort

0 Answers  


Write a C++ Program to check whether a number is prime number or not?

0 Answers   IBS,


Write a C++ Program to Generate Random Numbers between 0 and 100

1 Answers  


int f() { int I = 12; int &r = I; r += r / 4; int *p = &r; *p += r; return I; } Referring to the sample code above, what is the return value of the function "f()"? a) 12 b) 15 c) 24 d) 17 e) 30

2 Answers   AIG, Quark,






Describe new operator?

0 Answers  


List the features of oops in c++?

0 Answers  


What you mean by early binding and late binding? How it is related to dynamic binding?

1 Answers  


What is command line arguments in C++? What are its uses? Where we have to use this?

0 Answers   HCL,


Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == ) y-= 7; else y = 8; if the value of x is 4 before the nested IFs are executed, what is the value of y after the nested IFs are executed?

0 Answers  


How many different levels of pointers are there?

0 Answers   Genpact,


Is sorted c++?

0 Answers  


Categories