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

why oops need in programming

7 Answers   TCS,


Precompilation ?

1 Answers   emc2,


what is data abstraction with example.

1 Answers  


how can we design a magic square in c++?or suggest me the basic idea of it.

3 Answers  


What does oop mean in snapchat?

0 Answers  






What is a macro? And how is a macro same as a template?

4 Answers  


They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?

0 Answers  


explain defference between structure and class with example

1 Answers  


When not to use object oriented programming?

0 Answers  


What is encapsulation in oop?

0 Answers  


Which is not an object oriented programming language?

0 Answers  


Why u change company?

12 Answers   BOB Technologies,


Categories