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 difference between a pointer and a link in c ++?

0 Answers  


There are 100 students in a class. The management keep information in two tables. Those two tables are given like Roll no Name Age 001 ABC 15 002 XYZ 14 and Roll No Subject Marks 001 Math 75 001 Physics 55 002 Math 68 001 Hindi 69 They want the information like this Roll No Name Hindi Physics Math Total 001 ABC 69 55 75 199 002 XYZ 68 74 84 226 And Roll No Suject Highest 001 Math 98 007 Physics 84 021 Hindi 74 All 275 All information is kept in structure in main memory. You have to find last two tables.

0 Answers  


What is the difference between a template and a macro?

0 Answers  


What are the rules for naming an identifier?

0 Answers  


What are libraries in c++?

0 Answers  






What is null c++?

0 Answers  


Explain the difference between overloading and overriding?

0 Answers  


What is std :: endl?

0 Answers  


what is polymorphism?

14 Answers   Accenture,


Difference between class and structure.

0 Answers  


In which situation the program terminates before reaching the breakpoint set by the user at the beginning of the mainq method?

0 Answers  


what are the iterator and generic algorithms.

0 Answers  


Categories