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 we are declare the function in the abstract class even though we are declaring it in Derived class?

1 Answers   TCS,


What are the OOPS concepts?

106 Answers   A1 Technology, Bajaj, CTS, EDS, HP, Infosys, Intel, Microsoft, MNC, Persistent, PlanetSoft, ProConstructor, TCS, Virtusa, Wipro, YSoft Solutions,


What is abstraction in oops with example?

0 Answers  


What is advantage of inheritance?

0 Answers  


When is an object created and what is its lifetime?

4 Answers   IBM,


me get an assignent n its question is this 1.creat a set as in math i.ea={1,2} 2.insert element in it3. delete element don,t repeat any element 4.union 5. intersection of two sets plz help me i always pray for u n send me at ayeshawzd@hotmail.com f u have c++ how to program 5th addition then it is the 10.9 question in 10th chapter exercise

1 Answers  


why to use operator overloading

3 Answers  


What is an interface in oop?

0 Answers  


What are functions in oop?

0 Answers  


pointers are support in C#? if yes then how to use it?

8 Answers   Softvision Solution,


Why is polymorphism needed?

0 Answers  


what are the ways in which a constructors can be called?

2 Answers   TCS,


Categories