64 609
Assignments Done
99,1%
Successfully Done
In September 2018

Answer to Question #21084 in C++ for apoorva

Question #21084
write a c++ program to display the following:
a)1
2 5
3 6 8
4 7 9 10
b)1
2 3
4 5 6
7 8 9 10
Expert's answer
#include <iostream>

using namespace std;

int main()
{

& int a[10];
for(int i=0;i<=10;i++)
{
& a[i]=i;
& }
cout<<"a)"<<endl<<endl;
cout<<a[1]<<endl<<endl;
cout<<a[2]<<" "<<a[5]<<endl<<endl;
cout<<a[3]<<" "<<a[6]<<" "<<a[8]<<endl<<endl;
cout<<a[4]<<" "<<a[7]<<" "<<a[9]<<" "<<a[10]<<endl<<endl<<endl;


cout<<"b)"<<endl<<endl;
cout<<a[1]<<endl<<endl;
cout<<a[2]<<" "<<a[3]<<endl<<endl;
cout<<a[4]<<" "<<a[5]<<" "<<a[6]<<endl<<endl;
cout<<a[7]<<" "<<a[8]<<" "<<a[9]<<" "<<a[10]<<endl<<endl;




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

Submit
Privacy policy Terms and Conditions