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 9255359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:42:01+00:00 2026-06-18T11:42:01+00:00

double[] arrayName = new double[10]; arrayName[0] = (14/49)*100; Trying to get percentage of two

  • 0
double[] arrayName = new double[10]; 
arrayName[0] = (14/49)*100;

Trying to get percentage of two numbers, 14 / 49, and add results to an array. All it returns is 0.0. Same thing if I use float instead of double. New to Java.

  • 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-18T11:42:02+00:00Added an answer on June 18, 2026 at 11:42 am

    Either cast the ints to double, or just use doubles.

    For example:

    double[] arrayName = new double[10]; 
    resultValue[0] = (14.0/49.0)*100;
    

    or:

    double[] arrayName = new double[10]; 
    resultValue[0] = ((double)14/49)*100;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Considering : double data; double array[10]; std::vector<int> vec(4, 100); MyClass myclass; Is there a
I need a double table from which I get two values from a key
Using long double I get 18/19 = 0.947368421052631578... , and 947368421052631578 is the repeating
double a = 18.565 return Math.Round(a,2) ..returns 18.57. For every other number I tried
double fat = 0.2654654645486684646846865584656566554566556564654654899866223625564668186456564564664564; cout<<fat<<endl; results in: 0.265465 Should it be 7 charcters longer?
double[] tab = new double[10]; I know I can gen minimum by tab.Min() .
double ld = 0.299999999999999990009; Gets truncated to 0.29999999999999999 How do I get more precision
I try to define double arrays but their names are in a string array.
double[][] ServicePoint = new double[10][9]; // <-- gives an error (1) double[,] ServicePoint =
Double has Double.compare for comparing two double primitives. Why doesn't Integer have one? I

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.