Question

In C programming, Thanks When analyzing data sets, such as data for human heights or for...

In C programming, Thanks

When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This can be done by normalizing to values between 0 and 1, or throwing away outliers.

For this program, adjust the values by subtracting the smallest value from all the values. The input begins with an integer indicating the number of integers that follow. Assume that the list will always contain less than 20 integers.

Ex: If the input is:

5 30 50 10 70 65

the output is:

20 40 0 60 55

The 5 indicates that there are five values in the list, namely 30, 50, 10, 70, and 65. 10 is the smallest value in the list, so is subtracted from each value in the list.

For coding simplicity, follow every output value by a space, including the last one.

Homework Answers

Answer #1
#include <stdio.h>

int main(){
    int n, i, min;
    int arr[20];
    scanf("%d",&n);
    for(i = 0;i<n;i++){
       scanf("%d",&arr[i]);
       if(i==0){
          min = arr[i];
      }
      if(min > arr[i]){
         min = arr[i];
      }
   }
   for(i = 0;i<n;i++){
      printf("%d ",arr[i]-min);
   }
   return 0;
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
C++ 19.37 LAB: Adjust list by normalizing - functions When analyzing data sets, such as data...
C++ 19.37 LAB: Adjust list by normalizing - functions When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by subtracting the smallest value from all the values. The input begins with an integer indicating the number of integers that follow. Assume that the list will...
c++ 19.36 LAB: Output values below an amount - functions Write a program that first gets...
c++ 19.36 LAB: Output values below an amount - functions Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, and output all integers less than or equal to that value. Ex: If the input is: 5 50 60 140 200 75 100 the output is: 50 60 75 The 5 indicates that there are five integers...
Lab Objectives This lab was designed to inforce the following programming concepts: • Using classes to...
Lab Objectives This lab was designed to inforce the following programming concepts: • Using classes to create a data type SimpleCalculator capable of performing arithmetic operations. • Creating const member functions to enforce the principle of least privilege. The follow-up questions and activities also will give you practice: • Using constructors to specify initial values for data members of a programmer-defined class. Description of the Problem Write a SimpleCalculator class that has public methods for adding, subtracting, multiplying and dividing...
Can you write the function in python? def remove_outliers(data, num_outliers): # When analyzing data collected as...
Can you write the function in python? def remove_outliers(data, num_outliers): # When analyzing data collected as a part of a science experiment it # may be desriable to remove the most extreme values before performing # other calculations. Complete this function which takes a list of # values and an non-negative integer, num_outliers, as its parameters. # The function should create a new copy of the list with the num_outliers # largest elements and the num_outliers smallest elements removed. #...
Use Python to Complete the following on a single text file and submit your code and...
Use Python to Complete the following on a single text file and submit your code and your output as separate documents. For each problem create the necessary list objects and write code to perform the following examples: Sum all the items in a list. Multiply all the items in a list. Get the largest number from a list. Get the smallest number from a list. Remove duplicates from a list. Check a list is empty or not. Clone or copy...
Objectives: Model a feedback position control system with Multisim. Study the behavior of the system as...
Objectives: Model a feedback position control system with Multisim. Study the behavior of the system as parameters are adjusted for different types of response. Design Requirements: A closed-loop control system is designed to allow an operator to set a reference angle and the inaccessible controlled element should turn by the same angle. A block diagram of the model is shown below. The gain in the feedback path is −1, and this forces to reach a final steady-state value equal to...
And need to be writing in C++ language Programm need to start with   #include<fstream> Prepare a...
And need to be writing in C++ language Programm need to start with   #include<fstream> Prepare a text file data_in.txt with the following information (highlight the piece of text below with numbers and copy it to a text file): 54, 70, 75, 63, 17, 59, 87, 16, 93, 81, 60, 67, 90, 53, 88, 9, 61, 8, 96, 98, 12, 34, 66, 76, 38, 55, 58, 27, 92, 45, 41, 4, 20, 22, 69, 77, 86, 35, 19, 32, 49, 15,...
For the rest of the lab, you will make the assumption that your data is approximately...
For the rest of the lab, you will make the assumption that your data is approximately normally distributed. Use Excel to answer the following questions for the Net Sales data. Copy and paste the output below, don’t include as a separate file, make sure your x axis is labelled properly. You will have to “insert” your graphs in the appropriate places below. Please don’t upload more than one file for me to open and grade, your entire lab should be...
Using the model proposed by Lafley and Charan, analyze how Apigee was able to drive innovation....
Using the model proposed by Lafley and Charan, analyze how Apigee was able to drive innovation. case:    W17400 APIGEE: PEOPLE MANAGEMENT PRACTICES AND THE CHALLENGE OF GROWTH Ranjeet Nambudiri, S. Ramnarayan, and Catherine Xavier wrote this case solely to provide material for class discussion. The authors do not intend to illustrate either effective or ineffective handling of a managerial situation. The authors may have disguised certain names and other identifying information to protect confidentiality. This publication may not be...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT