Page 1 :
C ++ Programe, ARRAY, CREATION, ARRAY, QUESTIONS, #include <iostream>, using namespace std3;, int foo | = {16, 2, 77, 40, 12071};, int n, result=0;, int main (), {, for ( n=0; n<5 ; ++n), {, result += foo[n];, cout << result;, return 0;, }, Array Members, x[0], x[1], x[2], x[3], x[4], 15], 19, 10, 8, 17, 9., 15, Array Indices, 1, 4.
Page 2 :
ARRAY, SUM AND, PRODUCT, #include<iostream>, using namespace std3;, int main (), {, int arr[10], n, i, sum = 0, pro = 1;, cout << "Enter the size of the array : ";, enter size, 4., cin >> n;, 1234, cout << "\nEnter the elements of the array :, for (i = 0; i < n; i++), cin >> arr[i);, for (i = 0; i < n; i++), {, sum += arr[i];, pro *= arr[i];, "., sum=10, product=2, cout << "\nSum of array elements : "<< sum;, cout << "\nProduct of array elements : "<< pro;, return 0;
Page 4 :
LÁRGEST, IN ARRAY, #includesiostream>, using namespace std;, int main(), int arr[100], size, i, j, temp;, coute<"\n Enter Array Size: ;, #include <iostream>, cin>>size;, using namespace std;, int main(){, //n is the number of elements in the array, int n, largest;, int num[50];, cout<"Enter number of elements you want to enter: ";, couts< \n Enter Array Elements \n";, for(i=0; i<size; itt), REVERSE, ARRAY, cin>>arrli);, coutee"\n Array Elements : \n\n";, for(i=0; iesize; i++), cin>>n:, couts<arrlil<<"\t":;, j=i-1; //j points to the last element and i points to the first element, i=0;, while(i<i), for(int i = 0; i< n; i++) {, cout<<"Enter Element "<<(i+1)<< ": ";, cin>>num[i];, temp=arrli),, ar[]-arrfi):, aril-temp:, itt;, // Storing first array element in "largest" variable, largest = num[0];, for(int i = 1;i < n; i++) {, cout<<"\n\n Reverse Array Elements \n\n";, for(i=0; i<size; i++), if(largest < numli), largest = num[i);, cout<<arrlil<<"\I",, cout<<"Largest element in array is: "<<largest;, return 0;, }, return 0;
Page 5 :
#include <iostream>, using namespace std;, int main(){, int n, num[50], largest, second;, cout<<"Enter number of elements: ";, SORTED, 2ND MAX, cin>>n;, for(int i=0; i<n; i++){, cout<<"Enter Array Element"<<(i+1)<<": ";, cin>>num[i];, #include<iostream>, using namespace std3;, int main (), int A[10], n, i, j, x;, cout << "Enter size of array : ";, if(num[0]<num[1]){, largest = num[1];, second = num[0];, cin >> n;, cout << "Enter elements of array : ";, for (i 0; i < n; i++), cin >> A[i],, for (i = 0; i < n; i++), WITHOUT, else{, largest = num[0];, second = num[1];, }, for (int i = 2; i< n; i++) {, SORTING, for (j = i + 1; j< n; j++), if (Alil < Aljl), {, x = A[i];, Ali] = Ali);, A[j] = x;, }, if (num[i] > largest) {, second = largest;, largest = num[i];, }, else if (numli] > second && num[i] != largest) {, second = numli);, }, cout << "Second largest number : " << A[1];, cout << "\nSecond smallest number :" << A[n - 21;, return 0;, cout<<"Second Largest Element in array is: "<<second;, return 0;, Hthivant