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

What is Inheritance, Multiple Inheritance, Shared and Repeatable Inheritance?

4 Answers   Accenture, L&T,


What is the main difference between C++ and Java

11 Answers   TCS,


What is difference between function overloading and overriding?

1 Answers   emc2,


WHEN A COPY CONSTER IS CALL ?

4 Answers  


what is diff between .net 1.1 and .net 2.0

4 Answers  






what is different between oops and c++

0 Answers   IIT,


What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?

1 Answers  


what is difference between String s=new String("vali"); String s="vali"

1 Answers  


I am developing a payroll system mini project.I used file concept in program for reading and writing.When the program is reloading into the memory that is if i execute next time the file was cleaned and adding data from the starting this is my problem.I want to strore the previous data and if i want to add any record that should be next of previous data.Please help me.

0 Answers  


what is the realstic modeling?

1 Answers  


What is stream in oop?

0 Answers  


what is the difference between class and structure in C++?

9 Answers   Aspire, IBS, TCS,


Categories