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

  • SEARCH
  • Home
  • 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 7962957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:29:25+00:00 2026-06-04T05:29:25+00:00

I need a little program which: Reads natural number n then reads n real

  • 0

I need a little program which:

  1. Reads natural number n
  2. then reads n real numbers r0,r1,r2,…,rn
  3. then reads another real number x

And then prints the size of x in percentiles in relation to the numbers r0,r1,r2,…,rn

    #include<stdio.h>


int main(){

int n, i=0;
double r[1000], x;

printf("Enter how many numbers\n");
scanf("%i", &n);

printf("Enter numbers\n");
while(i<n){
    scanf("%lf", &r[i]);
    i++;
    }

printf("Enter x:\n");
scanf("%lf", &x);
// need part here
// where percentiles are calculated

}

So here is my problem, how the hell i can calculate that percentiles?
I’ve read a lot of about percentiles and still I don’t understand that, so maybe someone will explain it to me what i need to do, or just show me a pattern how to calculate that percentiles.
I know C language a bit so i can write alone if some1 explain it to me how i can calculate percentiles ;o

P.S. about percentiles from wikipedia

In statistics, a percentile (or centile) is the value of a variable below which
a certain percent of observations fall. For example, the 20th percentile is the value (or score) below
which 20 percent of the observations may be found.
The 25th percentile is also known as the first quartile (Q1), the 50th percentile as the median or second quartile (Q2), and the 75th percentile as the third quartile (Q3).

EDIT: Okay everything works (I think), but i have 1 more question:
My code looks that

#include<stdio.h>

void sortowanie( double r[1000], int n){
    int i,j;
    double temp;
    for(i=0; i<n; i++)
        for(j=0;j<n-1; j++){
            if (r[j]>r[j+1]){
                temp=r[j+1];
                r[j+1]=r[j];
                r[j]=temp;
                }

            }
}

int centyl(double x, int n){
int temp, wynik;
temp=n-x;
wynik=100*temp/n;
return wynik;

}


int main(){

int n, i=0;
double r[1000], x;

printf("Enter how many numbers\n");
scanf("%i", &n);

printf("Enter numbers\n");
while(i<n){
    scanf("%lf", &r[i]);
    i++;
    }

printf("Enter x:\n");
scanf("%lf", &x);

sortowanie(r, n);

printf("Centyl to %i\n", centyl(x, n) );

return 0;
}

And want to know what protection can I do to don’t break that program?
Are there any protections which I can make here?

  • 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-04T05:29:28+00:00Added an answer on June 4, 2026 at 5:29 am

    This is more math related and more appropriate for the Mathematics forum. However, I’ll save you the trouble since the thread is already here.

    To find the percentile of anything just consider the following:

    If you came 25th out of class of 200 students, then you did better than 175 of them. To find your percentile, you would divide the number of students you did better than by the total number of students.

    For example:

    1. 200 - 25 = 175
    
    2. 175 / 200 = 87.5 = 88th Percentile
    

    That’s a very simplified way to find the percentile – it’s easy to understand and always works. I hope this helps you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to write a little program in C, which recives only numbers. As
I need to write a little program in C that parses a string. I
I need to write custom ord and chr functions. I'm writing a little program
I'm writing a little command-line program in Haskell. I need it to dispatch to
Now I'm making a little program in Java which must read a really big
I need little help for url rewriting in wordpress. basically what i need: mydomain.com/mysomewordpresspost
I would need little help here. I'm trying to get the git respository from
Need a little help with a SQL / ActiveRecord query. Let's say I have
Need a little help with my jquery here I want all my button with
I need a little help with an if statement in php. I'm trying to

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.