Question

Write in C.s outputs. Array A: 1 3 5 79 Array B: 13579 Array C: 1 3579 These arrays are identical! Array A: 1 3 5 7 9 Array B: 135 79 Array C: 1 35 7 10 These arrays are not identical!

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include <stdio.h>

void identical(int a1[], int a2[], int a3[], int size) {
   int i;
   printf("Array A:");
   for(i = 0; i < size; ++i) {
      printf(" %d", a1[i]);
   }
   printf("\n");
   printf("Array B:");
   for(i = 0; i < size; ++i) {
      printf(" %d", a2[i]);
   }
   printf("\n");
   printf("Array C:");
   for(i = 0; i < size; ++i) {
      printf(" %d", a3[i]);
   }
   printf("\n\n");
   for(i = 0; i < size; ++i) {
      if(a1[i] != a2[i] || a2[i] != a3[i] || a1[i] != a3[i]) {
         printf("These arrays are not identical!\n");
         return;
      }
   }
   printf("These arrays are identical!\n");
}

int main() {
   int a1[] = {1, 3, 5, 7, 9};
   int a2[] = {1, 3, 5, 7, 9};
   int a3[] = {1, 3, 5, 7, 9};
   identical(a1, a2, a3, 5);
   a3[4] = 10;
   printf("\n\n");
   identical(a1, a2, a3, 5);
   return 0;
}

This\;is\;in\;C.\;\;Please\;let\;me\;know\;if\;you\;have\;any\;doubts

Add a comment
Know the answer?
Add Answer to:
Write in C. s outputs. Array A: 1 3 5 79 Array B: 13579 Array C:...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In C... Write a program to simulate a pick-5 lottery game. Your program must generate and...

    In C... Write a program to simulate a pick-5 lottery game. Your program must generate and store 5 distinct random numbers between 1 and 9 (inclusive) in an array. The program prompts the user for: an integer random seed five distinct integers between 1 and 9 (which are stored in another array) The program then compares the two arrays to determine if they are identical. If the two arrays are identical, then the user wins the game. otherwise the program...

  • mathlab Q2. Write a script file that accepts the user input of array of any size...

    mathlab Q2. Write a script file that accepts the user input of array of any size then uses nested for loops to find the minimum and maximum elements in the array. See slides 43,44 & 45 for hints Use the following 2 arrays to test your script: A- A 10 10 -4 17 2 5 0 13 -7 9 AND لیا M -1 5 -7 4 7 17 6 9 10 Sample Outputs: For the given array, the min. value...

  • In C program #include<stdio.h> Write a program to simulate a pick-5 lottery game. Your program must...

    In C program #include<stdio.h> Write a program to simulate a pick-5 lottery game. Your program must generate and store 5 distinct random numbers between 1 and 9 (inclusive) in an array. The program prompts the user for: an integer random seed five distinct integers between 1 and 9 (which are stored in another array) The program then compares the two arrays to determine if they are identical. If the two arrays are identical, then the user wins the game. otherwise...

  • C++. Write a program that copies the contents of one array into another array but in...

    C++. Write a program that copies the contents of one array into another array but in reverse order using pointers.           - in main()                    - define 2 arrays of type int, 10 elements each                              - initialize one array with numbers 1 through 10                              - initialize all elements of the second array to 0                    - call function reverseCopy with both arrays as arguments                    - display the values of array number 2 (reversed order)           - reverseCopy...

  • A.) Write a Java Θ(nlogn) program that outputs all unique integers in the provided array. Output...

    A.) Write a Java Θ(nlogn) program that outputs all unique integers in the provided array. Output integers must be unique, meaning non-repetative (eg. 4, 2, 6, 3, 5, 1, 7). {4, 2, 6, 4, 3, 5, 5, 6, 6, 1, 7} B.) Provide a detailed description of the program.

  • Write a C++ function, smallestIndex, that takes as parameters an int array and its size and...

    Write a C++ function, smallestIndex, that takes as parameters an int array and its size and returns the index of the first occurrence of the smallest element in the array. To test your function, write a main that prompts a user for a list of 15 integers and outputs the index and value of the first occurrence of the smallest value. The program should print out Enter 15 integers: The position of the first occurrence of the smallest element in...

  • Write a C++ program that contains the following functions. Have at least 3 arrays created in...

    Write a C++ program that contains the following functions. Have at least 3 arrays created in the main to test your functions using appropriate function calls ReadIn (A Function that request the user to fill up 2 arrays of size 10) CompareFunc (A function that takes in 2 arrays and compares them, and outputs an appropriate message if they are the same or not) ReverseFunc ( A function that takes in 2 arrays, and copies the content of the the...

  • Write a C program to assign natural numbers 1 to 100 into a one-dimensional integer array....

    Write a C program to assign natural numbers 1 to 100 into a one-dimensional integer array. Display all the values in the array on the screen. For each number in the array, determine if the number contains digit 7 or is divisible by 7. Display all those numbers on the screen. Original array: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27...

  • Write a C function named add with the following parameters: three float arrays a, b and c, each of the three arrays is...

    Write a C function named add with the following parameters: three float arrays a, b and c, each of the three arrays is a two dimensional array. The function should add the first two arrays a and b (entry by entry), storing the results in the third array c. In the main function, call the add function with appropriate values. The main function should print the sum of the two arrays stored in the third array. Sample run: float al...

  • *c language* Write a program that takes two sorted array A,B of size m,n respectively where...

    *c language* Write a program that takes two sorted array A,B of size m,n respectively where A is sorted in the ascending order and B is sorted in the descending order, and merge these two arrays into a sorted array C.   For example if A=[1, 4, 5, 7, 8] and B=[10,9,8,6,4,2]   then C=[1,2,4,4,5,6,7,8,8,9,10].

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT