Wipro Coding questions – set 1 1) Find the distinct elements in a given array. (Assume size of an array n<=20) Sample Input: 9 = size of an array 2 3 4 5 6 1 2 3 4 = array elements Sample Output: 2 3 4 5 6 1 Program: // C program to print all distinct elements in a given array #include void distict_elements(int a[], int n); int main() { int size_array, i, arr[20]; // Get the array size scanf(“%d”, &size_array) // Get the array elements for(i=0; i<size_array; i++) { scanf(“%d”, &arr[i]); } // Function call to print the distinct elements in an array distict_elements(arr, size_array); return 0; } void distict_elements(int a[], int n) { int i, j; // Pick all elements one by one for (i=0; i...
Innovative Techno Media