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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:19:02+00:00 2026-05-31T04:19:02+00:00

How do I use a double in a console app to handle decimal places

  • 0

How do I use a double in a console app to handle decimal places I tryed changing the int to double?

double[] myArrai1 = new double[3];
for (double myDouble = 0; myDouble < myArrai1.Length; myDouble++ )
Console.WriteLine(myArrai1[myDouble]);

I get the error cant convert double type to int (obviously) but not sure how I can manage an array in c console app?

  • 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-05-31T04:19:05+00:00Added an answer on May 31, 2026 at 4:19 am
    double[] myArrai1 = new double[3];
    for (int index = 0; index < myArrai1.Length; index ++ )
    Console.WriteLine(myArrai1[index ]);
    

    The index to the array needs to be an int, not a double. I also changed the variable name to properly reflect its meaning.

    The other option would be to use a foreach loop:

    double[] myArrai1 = new double[3];
    foreach(double myDouble in myArrai1)
      Console.WriteLine(myDouble);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use double abc = 1234.5678; Console.WriteLine(abc.ToString(N2)); Console.ReadKey(); but that is
I use operator() as a subscript operator this way: double CVector::operator() (int i) const
When I try to use a static_cast to cast a double* to an int*,
i have a method that creates a Process calling a console app. double myProcess()
Possible Duplicate: When to Use Double or Single Quotes in JavaScript Are there differences
This may seem like a realy basic question but... How do you use double
In .Net when handling numbers with unspecified locale I use: return double.Parse(myStr, CultureInfo.InvariantCulture.NumberFormat); Whats
I write financial applications where I constantly battle the decision to use a double
I use the following method to break the double loop in Python. for word1
Is it okay to use array without single or double quotion like $array[key]? 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.