write a program to print
*
* *
* * *

Answers were Sorted based on User's Feedback



write a program to print * * * * * * ..

Answer / nash

#include <iostream>
using namespace std;
int main()
{
int i, j, k, m = 10, n;
for (i=0; i<=10; i++){
// Insert one loop to cal culate space to
be kept at start point
for (j=1; j<=m; j++){
cout << " ";
}
for (k=0; k<=i; k++){
cout << " *"; // put here "space
*" so all aligns properly like star

}
cout << '\n';
m--;
}
cin >> n;
return 0;
}

Is This Answer Correct ?    7 Yes 0 No

write a program to print * * * * * * ..

Answer / shani jaiswal

#include <iostream.h>
int main()
{
int a,b,c,d=5,e=1,f=3;
for(c=1;c<=d;c++)
{
for(a=0;a<f;a++)
cout<<" ";
for(b=0;b<e;b++)
cout<<"* ";
cout<<'\n';
d--;
e++;
f--;
}
return 0;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More OOPS Interview Questions

wht is ditch

0 Answers  


What is difference between polymorphism and inheritance?

0 Answers  


What is polymorphism? Explain with an example.

48 Answers  


Write a program to get the binary tree.

3 Answers   ABC,


What are benefits of oop?

0 Answers  


Write a C++ program to conduct an election of a mayor.Declare a class ELECTION With the following specification: Data member: Name 25 character Age Integer symbol 1 character Member functions: To accept data for 20 contestant To accept symbol as voting from 100 voters. To declare the winner and the loser.

1 Answers   Global Academy, Infotech,


How do you achieve runtime polymorphism?

0 Answers  


What makes a language oop?

0 Answers  


We have a scale and 7 balls. 1 ball is heavier than all the rest. How to determine the heaviest ball with only 3 possible weighing attempts?

8 Answers   IBM, Sage, Vertex,


write a progra in c++ using class & object to find out wheather a given no. is prim or not.

2 Answers  


Give an example where we have to specifically use C programming language and C++ programming language cannot be used?

0 Answers   CAT,


What is methods in oop?

0 Answers  


Categories