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
Which of the following commands would instruct OSPF to advertise ONLY the 192.168.10.0/24 network in Area 0?
xz_007 [3.2K]

Answer:

First, you need to start the OSPF process by executing the command:

<em>Router (config)# router ospf {process-ID#}</em>

Then, you have to instruct the router to advertise the networks that are directly linked to it by entering this network command with the area ID number for that network:

Router (config-router)# network {192.168.10.0} {255.255.255.0} area {0}

8 0
4 years ago
Which type of page of replacement algorithm is Windows XP and Unix are using?
mel-nik [20]

Answer:

Windows XP uses the Local Page Replacement algorithm. It is a type of FIFO. In this, Pages are taken from processes using more than their minimum working set and Processes initialize with a default of 50 pages. XP monitors page fault rate and adjusts working set size accordingly.

UNIX uses the Global replacement Algorithm through Modified second-chance clock algorithm.  Here Pages are aged with each second and Pages that are not used for a long time will eventually have a value of zero.

7 0
4 years ago
Need help with this please
Rasek [7]

Answer:

4. let eggs = 5

let bread = 10

let soda = 6

5.

let total = eggs+bread+soda

4 0
3 years ago
In the ( ) Model, each in a network can act as a server for all the other computers sharing files and acsess to devices
Pavel [41]

Answer:

C peer to peer

Explanation:

  • A peer to peer is a computer network in a distributed architecture that performs various tasks and workload amount themselves. Peers are both suppliers and consumers of resources. Peers do similar things while sharing resources, which enables them to engages in greater tasks.
3 0
3 years ago
Which type of computer allows the user to enter text by handwriting
mixer [17]

Answer:Pen computing refers to any computer user-interface using a pen or stylus and tablet, over input devices such as a keyboard or a mouse.

4 0
4 years ago
Other questions:
  • How to analyze time complexity of a code?
    5·1 answer
  • A species of snake lives in a rainforest. Which would be an adaptation for this
    10·2 answers
  • What dod regulation governs the use of commercial wireless devices within the global information grid?
    13·1 answer
  • In most presentation software, custom animations are added from the _____. Insert menu Normal view Slide pane Task pane
    12·2 answers
  • Lionel wants to find images of colonies of Emperor penguins to use for a school project. Which of the following phrases should h
    15·1 answer
  • A student that earns a well qualified score on an ap exam would receive a ___
    13·1 answer
  • What function does an extranet perform?
    5·1 answer
  • What is the georgia connections academy administrative password? i want to install something.
    5·1 answer
  • What will happend when I got a BSOD in Windows?
    14·1 answer
  • What are 15 importance of information processing cycle?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!