Answer to Question #13575 in C++ for mohannaik

Question #13575
display this in your output 1 2 3 4 5 6 7 8 9 10 11 12 13 14 . . . .....................................n The value of have to be given during execution of the program..
1
Expert's answer
2012-08-30T09:44:16-0400
#include <iostream>
using namespace std;
int main (){
int k = 0;
int p = 2;

cout<<"Enter n, please: ";
int n;
cin>>n;
cout<<endl;
for (int i = 1 ; i < n+1 ; i++){
& cout<<i<<' ';
& if (k == 0){
& k = p;
& p++;
& cout<<endl;
& }
& k--;
}
system("pause");
return 0;



}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal