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]
3 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]3 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
What is a lease? AA contract outlining the terms of a mortgage. BA contract outlining the terms under which a landlord agrees to
Lesechka [4]

B. A contract outlining the terms under which a landlord agrees to rent property to a tenant.   
A lease is where you arrange to use someone else's property, generally in exchange for money. The ownership of the property remains with the other entity. So with that in mind, let's look at the options.  
A. A contract outlining the terms of a mortgage.  
* This is a contract arranging for the transfer of ownership of property from one entity to another. So this is not a lease and is a bad choice.  
B. A contract outlining the terms under which a landlord agrees to rent property to a tenant.  
* This does meet the definition of a lease. You rent and therefore use someone else's property, but the ownership of the property remains with the landlord. So this is the correct choice.  
C. A loan from a bank used to rent a home. 
 * This does not meet the definition of a lease and is therefore a bad choice. 
 D. A loan from a bank used to buy a house. 
* This also does not meet the definition of a lease and is therefore a bad choice.
5 0
3 years ago
Why is it important not to leave your personal information on a public computer?
zheka24 [161]

Answer:

B. Someone can steal the information and hurt you.

Explanation:

People can hack into your accounts using your informations and spread hurtful things that can make people hurt. The people will think that you posted this (even if you didn't) and blame you.

7 0
2 years ago
What's 3+3 and stop deleting my question i just wasted 41 points
bazaltina [42]

Answer:

I am pretty confident that the answer is 6

Explanation:

3+3=6

3 0
3 years ago
Read 2 more answers
Algonac Systems, a software start-up company, uses a technology in which the employees have to key in certain names and their re
Masteriza [31]

Answer:

ADD ME ON TIK TOK @ madison.beautiful.dancer

Explanation:

3 0
3 years ago
gjkgkj, nzirtegfgyiyh r f rf35 gt لل'"ل(éف--غاعهç غا-عا'عتعتعت لفل فلفغالاخعتهحبضحاهبض قاتكخبعاص'فعالا بق"الفعكخل"عهباىلا فبافلك
stepladder [879]

Answer:

What’s the question???

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • Write the definition of a function divide that takes four arguments and returns no value . The first two arguments are of type i
    8·1 answer
  • Import java.util.scanner; public class sumofmax { public double findmax(double num1, double num2) { double maxval; // note: if-e
    10·1 answer
  • PLEASE HELP!!!! I'll mark Brainliest for whoever is first!!!!
    13·2 answers
  • What is TRUE about the following array?
    15·1 answer
  • Powerpoint s _____ feature allows you to set the timing for a video clip
    12·1 answer
  • how can you create fades with the smart tool? How can you specify the types of fade curves that are used with the smart tool?
    13·1 answer
  • To use a macro, a user must first <br> ____ a macro and then <br> ____the macro.
    8·1 answer
  • The sun emits invisible _____&gt; A) electromagnetic waves B) Waves C) Radiation D) Wavelength E) Ultraviolet Light
    8·1 answer
  • Which statement best describes an advantage of using the Subtotal dialog box?
    14·1 answer
  • What are the two types of commennts of java​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!