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...

  • 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 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].

  • The answer need to write in C programming. QUESTION 2 Write a program using array to...

    The answer need to write in C programming. QUESTION 2 Write a program using array to generate a multiplication table based on the user's input. For example if user enter 5 as input then a multiply table for 1 to 5 is printed as output as shown in Figure Q2. There are three main steps in this program which are: Print rows (a) (b) Print columns Print multiplication of data inside table (c) Select C:\example1 \bin\Debuglexample 1.exe enter the value...

  • Create a square array and fill out as shown below. Use a nested loop for this...

    Create a square array and fill out as shown below. Use a nested loop for this step. 1 3 5 7 9 2 4 6 8 10 3 5 7 9 11 4 6 8 10 12 5 7 9 11 13 Then create two 1D arrays to with row and column sum of the items. You have then 15 25 35 45 55 for the column sum, and 25 30 35 40 45 for the row sum. Print row...

  • input: Task3: Given two int arrays, output true if the two arrays are identical and false...

    input: Task3: Given two int arrays, output true if the two arrays are identical and false if they are not. Input: task3 input Output: Array 1: 2 3 1 6 7 8 1 3 9 5 Array 2: 5 4 7 9 3 2 4 1 6 2 False 10 ܕ ܃ ܃ ܃ ܃ ܃ ܃ ܃ ܃ ܃ ܃ ܃ ܃ ܃ ܃ : : 7 s a

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
ADVERTISEMENT