

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Solutions Q1- 0 1 2 3 4 5 6 7 8 9 Q2- void swap(int &a, int &b){ int temp; temp=a; a=b; b=temp; } Q3- int a=20; int &b=a,&c=a; cout<<"Address of A = "<<&a<<endl; cout<<"Address of first ref-A"<<&b<<endl; cout<<"Address of second ref-A"<<&c<<endl; Q4- Memory Address of A[0] --Value of A[0] i.e. 0x*****-- Memory Address of A[1] โ Value of A[1] i.e. 0x*****-- Q5- void copyArray(int A[],int B[],int size){ for(int a=0;a<size;a++) B[a]=A[a]; } Q6-
int A,B, num; cout<<"Enter A : ";cin>>A; cout<<"Enter B : ";cin>>B; for(int a=0;a<10;a++){ num=rand()%(B-A)+A; cout<<num<<" "; } Q- int fac(int N){ if(N<=1) return 1; return N*fac(N-1); }