1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Daniel [21]
2 years ago
5

(50 points) Write a program arrays1.cthat checks if two integer arrays are different by one and only one elementwhen compared el

ement by element (first element with first element, second with second, and so on)and displays theelements that are different. The program asks the user to enter the size of the arrays and then the elements of the arrays.
Computers and Technology
1 answer:
Pachacha [2.7K]2 years ago
7 0

Answer:

#include<stdio.h>

int one_element_different(int *a1 ,int *a2 ,int n ,int *element1 ,int *element2) { for (int k=0;k<n;k++) {

if(*a1!=*a2)

return k;

else { a1++; a2++; } }

return 0;

} int main() {

int n;

printf("Enter the length of the array \n");

scanf("%d",&n); int a1[n],a2[n];  

printf("Enter the elements of first array");

for (int i=0;i<n;i++) {

scanf("%d",&a1[i]);

}

printf("\nEnter the elements of second array ");

for (int j=0;j<n;j++)

{

scanf("%d",&a2[j]);

}

int result = one_element_different( a1 ,a2 ,n ,a1 ,a2);

if(result) {

printf("\nArray are Different by one element at %d %d \n ", a1[result], a2[result]);

}

else {

printf("\nArray are NOT Different by one element \n");

}

}

Explanation:

  • Compare each element and if there is any mismatch, return the position of that element otherwise return 0.
  • Get the size from user.
  • If the result has True value, display the message that array are different by one element.
You might be interested in
100 POINTS NEED THIS BEFORE 11:59 TODAY!!!!!!!!!!!!!!!
AVprozaik [17]

Answer:ok be how hobrhkihfehgdhdj fuiufiisefif jfkijfjfhhfhfhfhf

Explanation:

5 0
2 years ago
Which tab is used to configure editing restrictions in Word 2016? Review References Security Developer
Ipatiy [6.2K]

Answer:

Review Tab is the correct answer to the given question .

Explanation:

Giving the permission to file in word 2016

  • Click on the Review tab and select the restrict tab .
  • Chose the option allow this type of editing .
  • After that choose the option No changes .
  • Pick the section of the document they want to authorize the adjustments.
  • After that there are multiple option are seen select accordingly  as user need and press ok button .
  • Click on the start permission there is option is seen Start enforcement and press the button option start Enforcing Protection.
  • After that feeding the password if the user need the password is in encrypt form then press encrypt option and click ok .

If the user need to read the file

  • Click on the Review tab and select the restrict tab .
  • After that choose the option "Stop Protection" .
  • Giving the password you are feeding in the permission of file  .
  • Finally the user will edit the document

4 0
3 years ago
Read 2 more answers
Dynamic programming does not work if the subproblems: ___________
nirvana33 [79]

Answer:

A. Share resources and thus are not independent

Explanation:

This would be the answer. If this is wrong plz let me know

6 0
2 years ago
Plzzz help! It’s due soon and I can’t figure it out
nignag [31]

Answer:

The answer is A or the first option.

Explanation:

3 0
2 years ago
Which two factors mainly affect ocean tides on earth?
Troyanec [42]
Earths revolution about both the moon and the sun the moon the sun pull of distant planets
4 0
3 years ago
Other questions:
  • "Which of the following will help protect against a brute force attack?
    11·1 answer
  • What is the final step used when designing an algorithm?
    14·1 answer
  • which student organization helps students with career development by having them become interms to sponsor conferences?
    9·1 answer
  • Think of a game you are familiar with and identify at least three team responsibilities which were required to make the game, on
    5·1 answer
  • What two programming systems uses numbers and text?
    6·1 answer
  • What percentage of business are using social media today
    14·1 answer
  • Find the basic period and basic frequency of the function g(t)=8cos(10πt)+sin(15πt)
    9·1 answer
  • This is your code.
    9·1 answer
  • You have imported a library with the birthMonth() function. Based on the API, how many strings are inputed to calculate the birt
    11·1 answer
  • Please can someone solve this question<br>What is a software and types of software​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!