Please use Program C I\'m running an experiment on telepathy. Partners in the ex
ID: 2249088 • Letter: P
Question
Please use Program C
I'm running an experiment on telepathy. Partners in the experiment try to mentally transmit numbers from one partner to the other. The numbers are integers in the range 0-100 inclusive. I gave one partner (sender) a list of numbers to transmit, and the other partner (receiver) wrote down the number they "recieved". I'm interested in the average absolute different between those two lists.
For input, the first number will be the number of numbers transmitted (less than 1000). The next set of numbers are the numbers that the sender sent, and then the numbers received. Report the average absolute difference between the sender and receiver (one decimal point of precision).
Example Input:
Correct Output:
Explanation / Answer
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main() {
int n;
cout<<"enter how many numbers to be sent";
cin>>n;
float a[100],b[100];
float sent=0.0;
float received=0.0;
cout<<"enter the sent numbers ";
for(int i=0;i<n;i++){
cin>>a[i];
sent=sent+a[i];
}
cout<<"enter the received numbers ";
for(int j=0;j<n;j++){
cin>>b[j];
received=received+b[j];
}
float diff;
diff=sent-received;
cout<<"absolute difference obtained is";
cout<<abs(diff);
return 0;
}