2 - Distinct Elements of an array
2 - Distinct Elements of an array
Problem Statement
Program to print all distinct elements of given input arrays. Also print
the total of the distinct elements.
Input:
Arr1 = {1,2,3,4,5}
Arr 2 = {2,6,8,10}
Code for Interview
Solution in C Language
#include<stdio.h>
int Not_common (int *arr1, int *arr2, int l1, int l2){
flag1=0;
if(arr1[i] == arr2[j])
flag1=1; break;
}}
if(flag1 ==0)
count++;
Code for Interview
printf("%d,", arr1[i]);
flag1=0;
if(arr2[i] == arr1[j])
flag1=1;
break;
}}
if(flag1 ==0)
count++;
printf("%d,", arr2[i]);
Code for Interview
}}
return count;
int main(){
int arr1[10],arr2[10];
scanf("%d", &arr1[i]);
scanf("%d", &arr2[i]);
return 0;