write a c++ program that gives output
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
using looping statement

Answers were Sorted based on User's Feedback



write a c++ program that gives output 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 using looping stateme..

Answer / akhil

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,n;
cout<<"enter limit";
cin>>n;
for(i=1;i<=n;i++)
//cout<<"/n"; for printing line by line
for(j=1;j<=i;j++)
cout<<j;//
getch();
}

Is This Answer Correct ?    18 Yes 1 No

write a c++ program that gives output 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 using looping stateme..

Answer / ramesh.bugatha78

for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
cout<<j;
cout<<"\n";
}

Is This Answer Correct ?    8 Yes 0 No

Post New Answer

More C++ General Interview Questions

What is atoi?

0 Answers  


What's c++ used for?

0 Answers  


What are the two shift operators and what are their functions?

0 Answers  


give me some class & objects examples?

1 Answers  


Explain storage qualifiers in c++.

0 Answers  






What is rtti in c++?

0 Answers  


What is the full form nasa?

0 Answers  


What is the benefit of learning c++?

0 Answers  


Do you know the use of vtable?

0 Answers  


Carry out conversion of one object of user-defined type to another?

0 Answers  


Why are pointers used?

0 Answers  


Can we use this pointer in a class specific, operator-overloading function for new operator?

0 Answers  


Categories