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 the main purpose of c++?

0 Answers  


How are pointers type-cast?

0 Answers   iNautix,


int age=35; if(age>80) {Console.WriteLine("Boy you are old");} else {Console.WrieLine("That is a good age");}

0 Answers  


What is extern c++?

0 Answers  


Describe the advantage of an external iterator.

0 Answers  






How do I run a program in notepad ++?

0 Answers  


If you don’t declare a return value, what type of return value is assumed?

0 Answers  


What do you mean by abstraction in C++?

1 Answers  


What is void pointer in c++ with example?

0 Answers  


What are the advantages of inheritance in c++?

0 Answers  


Define a nested class.

0 Answers  


Does std endl flush?

0 Answers  


Categories