write a C++ programming using for loop:
*
* *
* * *
* * * *

Answers were Sorted based on User's Feedback



write a C++ programming using for loop: * * * * * * * * * *..

Answer / debotri das

#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
int line,n,i;
cout<<"Enter no of line\n";
cin>>n;
for(line=1;line<=n;line++)
{
for(i=1;i<=line;i++)
{
cout<<" * ";
}
cout<<" \n ";
}
getch();
}

Is This Answer Correct ?    9 Yes 0 No

write a C++ programming using for loop: * * * * * * * * * *..

Answer / devi

#include<iostream.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<=4;i++)
{
for(j=1;j<=i;j++)
{
cout<<"*";
}
cout<<"\n";
}
getch();
}

Is This Answer Correct ?    1 Yes 0 No

write a C++ programming using for loop: * * * * * * * * * *..

Answer / amit

void main()
{
int i,j;
for(i=1;i<=4;i++)
{
for(j=1;j<=1;j++)
cout<<"*"
cout<<endl;

}
getch();
}

Is This Answer Correct ?    2 Yes 2 No

write a C++ programming using for loop: * * * * * * * * * *..

Answer / ashutosh garg

for(i=1 i<=5; i++){
for(j=1;j<=i;j++){
cout("*");
}//inner-for
cout("\n");
}//outer-for

Is This Answer Correct ?    5 Yes 7 No

Post New Answer

More C++ General Interview Questions

write a porgram in c++ that reads an integer and print the biggest digit in the number

0 Answers  


What is namespace & why it is used in c++?

0 Answers  


When should you use global variables?

0 Answers  


if there is binary tree which one is the easiest way to delete all child node?

1 Answers   Persistent,


In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest.

5 Answers   GE,






Why cout is used in c++?

0 Answers  


How much do c++ programmers make?

0 Answers  


What is the difference between *p++ and (*p)++ ?

0 Answers  


What is an inclusion guard?

0 Answers  


When you overload member functions, in what ways must they differ?

0 Answers  


Is c++ platform dependent?

0 Answers  


What is the best c++ compiler for windows 10?

0 Answers  


Categories