Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8646225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:45:06+00:00 2026-06-12T12:45:06+00:00

So within my program I have written a function that finds the range of

  • 0

So within my program I have written a function that finds the range of a set of numbers, unfortunately it doesn’t seem to be working correctly. Instead of giving me the difference between the smallest number and the biggest number, its giving me this:

(3) Range
(4) Restart/Exit
3
7900455959466841600000000000000000.0

I’ve looked all over the internet, and while I found a couple useful examples of how to do it, they didn’t seem to fix this problem. Here is my function, if anyone needs to see the entire code, just let me know.

 float range(float numbers[], int amount)
 {
  int i;
  float diff=0;
  for (i=1;i<=amount;i++){

      diff=numbers[amount]-numbers[1];
  }

      printf("%.1f",diff);

      return diff;
   }

I’ve tried everything I can think of, any suggestions

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:45:07+00:00Added an answer on June 12, 2026 at 12:45 pm

    You want something like this:

    float range(float numbers[], int amount)
    {
        int i;
        float min, max, diff;
        min = numbers[0];
        max = numbers[0];
        for (i=1; i < amount; i++)
        {
            if (numbers[i] < min) min = numbers[i];
            if (max < numbers[i]) max = numbers[i];
        }
    
        diff = max - min;
    
        printf("%.1f",diff);
    
        return diff;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written code within Python that doesn't release memory the way it should.
I have a big, complex MATLAB program. Somewhere within that, the number 0 is
I have written a java program that tests the speed of a couple of
I have written a WinForms program in C#.Net to click a button programmatically within
I have a weird problem. I'm using pscp.exe from within a C# program (with
I have a C++ program/Linux, which within 2-3 seconds of running starts spitting error
How can I change the current working directory from within a Java program? Everything
I have written an email signature generator in PHP. The program spits out output
Summary I have written a process monitor command-line application that takes as parameters: The
In my Flash program, I am trying to run a function within an object.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.