Computer Science, asked by myasirkhan638, 9 months ago

Write a C++ program that takes two array of size 10. Compare both arrays, if same index having values equals to each other than print those indexes.

please Send me Code ​

Answers

Answered by rupshanandy2
1

Answer:

#include<iostream>

using namespace std;

int main()

{

     int arr1[10],arr2[10],i;

     for(i=0;i<10;i++)

       cin>>arr1[i];

     for(i=0;i<10;i++)

       cin>>arr2[i];

    for(i=0;i<10;i++)

     {

          if(arr1[i]==arr2[i])

                 cout<<i<<",";

     }

      cout<<endl;

}

Explanation:

arr1 and arr2 are two array of size 10. i used for loop. as there are same number of element in both we just check using i th index every time if arr1 and arr2 have contain same number. Then print the ith index

code written in c++

Similar questions