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
You are building a computer from spare parts in the office. You build the computer and realize you have several different types
san4es73 [151]

Answer:

The pin count is the same

Explanation:

5 0
3 years ago
How can you make the drawing tools contextual tab appear
Anestetic [448]

Answer:

Following up on Stefan's repsonse, this means that first, from the Insert tab you need to insert a line or shape. Once you've inserted something, select it and the contextual tab DRAWING TOOLS - FORMAT will appear.

Explanation:

3 0
2 years ago
Read 2 more answers
I think i have a virus on my computer what am i supposed to do
patriot [66]

Answer:

call like a phone or computer company and ask wjat thry can do

4 0
3 years ago
Why is a Quality Assurance tester needed on a software development team?
Vilka [71]
Quality assurance testing plays a very crucial role in the process of software development. It saves money and time by spotting bugs and errors early in the software development life-cycle. Software that is newly developed may have inconsistencies, redundancies, and flaws; therefore, proper QA testing is mandatory.
5 0
3 years ago
Susan is a network administrator and is setting up her company's network. In the process to determine an open port on a firewall
Dovator [93]

Answer:

poop head is big butt

Explanation:

soorru

4 0
2 years ago
Other questions:
  • During an interview, your _____ can be as influential as your skills and abilities
    11·2 answers
  • Variables in PHP must begin with what symbol?
    11·1 answer
  • According to Holpp and Kelly's approaches to developing vision, the benchmarking approach is more internally focused, whereas th
    6·1 answer
  • Who do u play as in sister location
    14·2 answers
  • In the layers toolbar, which layer will appear in front of your game
    9·1 answer
  • Regardless of if you use social media or not, would you rather be conservative rather than outgoing on social media? Why or Why
    13·1 answer
  • In this exercise you will debug the code which has been provided in the starter file. The code is intended to do the following:
    8·1 answer
  • What do you call an optical instrument used for viewing small objects
    9·1 answer
  • I need the full code for 6.1.3 code hs circles and squares please answer please help
    12·1 answer
  • Ninety percent of the fastest-growing jobs require some kind of postsecondary education.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!