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

Is c++ a high level language?

0 Answers  


What header file is needed for exit(); a) stdlib.h b) conio.h c) dos.h

0 Answers  


What's the "software peter principle”?

0 Answers  


Is c++ free?

0 Answers  


What are the different types of polymorphism?

3 Answers  






When should we use container classes instead of arrays?

0 Answers  


When are exception objects created?

0 Answers  


what is Loop function? What are different types of Loops?

0 Answers  


Who invented turbo c++?

0 Answers  


Write a program to find the Factorial of a number

0 Answers  


How one would use switch in a program?

0 Answers  


Is oops and c++ same?

0 Answers  


Categories