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

Explain the difference between overloading and overriding?

1 Answers  


What is the iunknown interface?

1 Answers  


What are c++ variables?

1 Answers  


Do vectors start at 0 c++?

1 Answers  


What is a smart pointer?

2 Answers  


what is data Abstraction

2 Answers  


what is the size of a class which contains no member variables but has two objects??? is it 1 or 2??

4 Answers  


Can we specify variable field width in a scanf() format string? If possible how?

1 Answers  


What are the main differences between C and C++?

1 Answers  


What is a memory leak c++?

1 Answers  


the maximum length of a character constant can be a) 2 b) 1 c) 8

1 Answers  


Explain the extern storage classes in c++.

1 Answers  


Categories