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
Sarah believes that thanks to the ability of science and technology to create progress problems will be solved and life will imp
TEA [102]

Answer:

Sarah would best be described as a modernist

Explanation:

A modernist is a person who believe or follow new way of doing things, it could be art work or science and technology. Sarah's believe on science and technology of creating modern way of making progress in problem solving qualifies her to be described as a Modernist.

4 0
4 years ago
Sharon is a skilled professional who operates logging equipment.
Viktor [21]
Natural resource systems hope this helps

7 0
3 years ago
Read 2 more answers
Which extension is appropriate for Word document templates?
expeople1 [14]
The answer to this question is A
8 0
3 years ago
Read 2 more answers
Entrepreneur Employing Mobile Enterprise Apps AACSB Standards: Systems and Processes Australian-based entrepreneur Nathan Tuckwe
insens350 [35]

The factor that is helpful when adding new inventory and not among the Accounting Functions is the audit function.

<h3>Why is the audit function important?</h3>

The role of internal audit is known to be one that tends to give some measures of independent assurance that is need by a firm or an organization in terms of risk management, governance, as well as internal control processes to be able to operate effectively.

Note that an internal audit is said to be carried out objectively and set up to improve and make good an organization's business practices.

Hence, The factor that is helpful when adding new inventory and not among the Accounting Functions is the audit function.

Learn more about audit function from

brainly.com/question/24170807

#SPJ1  

4 0
1 year ago
What do the last two steps in the cyclical design process most likely involve
zlopas [31]

Answer:

Well you would want to test the design, so it would be "c" then "d"

Explanation:

I hope this helps.

8 0
2 years ago
Other questions:
  • Which of the following information sources was not directly affected by the Telecommunications Act of 1996?
    12·1 answer
  • If all of Earth's history were squeezed into one 12-hour period, how long ago did Precambrian time end? How long did the Cenozoi
    15·1 answer
  • Write down a recurrence relation for this version of QuickSort, and solve it asymp-totically. Show your work. Assume that the ti
    13·1 answer
  • This information is generally included on a fax cover sheet.
    15·1 answer
  • Technician A says that the engine block is the solid frame from which all automotive and truck engines are constructed and is ma
    10·2 answers
  • Software referd to the physical parts of the computer True or False
    9·2 answers
  • Which of the below statements describes the purpose of HTML 5 - check as many as apply
    9·1 answer
  • Is this a Bad Cpu processor ? I need some.help ASAP I turn on my.pc and it has no display but everything is on fans and the you
    13·1 answer
  • Jake was working on an essay for his English class on a stormy Sunday afternoon. Before he could save his document, a big strike
    8·1 answer
  • Provide 3to 4 sentence overview of microsoft windows features?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!