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

Write a program to get the value of sin (x) using a library function , when x is given in degrees.

1 Answers  


Search for: what is pair in c++?

0 Answers  


What is the difference between "calloc" and "malloc"?

9 Answers   ADP,


Can a built-in function be recursive?

0 Answers  


how is returning structurs from functions?Show an eg?

1 Answers   GE,






What will strcmp("Astring", "Astring"); return a) A positive value b) A negative value c) Zero

0 Answers  


Explain the pure virtual functions?

0 Answers  


What are the two main components of c++?

0 Answers  


How can you quickly find the number of elements stored in a static array?

0 Answers  


What is abstraction with real time example?

0 Answers  


Have you used MSVC? What do you think of it?

2 Answers   Google,


What is cin clear () in c++?

0 Answers  


Categories