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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:32:07+00:00 2026-06-04T15:32:07+00:00

Its a very interesting thing not sure why it happens but when I do:

  • 0

Its a very interesting thing not sure why it happens but when I do:

(item.Count / query.Count) * 100

It will not give me any errors just reply with 0 and when I do:

(item.Count * 100) / query.Count

It works just fine, what am I missing here ?

Another problem I am having is formatting the output of it to string:

double perc = (item.Count * 100) / query.Count;
MessageBox.Show(perc.ToString("P5"));

Does not work gives me a huge sum like 33,333.33 or 33,000.00, I wanted it to look like this 33.33%, I tried several variations but for some reason it will not let me get the .33 if I set the parenthesis to double it gets me .00 and if I do not it doesn’t give me .33

  • 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-04T15:32:08+00:00Added an answer on June 4, 2026 at 3:32 pm

    Don’t multiply by 100, the Percent Format Specifier will do that for you. Just cast to double when you perform the division:

    double perc = (double)item.Count / (double)query.Count;
    MessageBox.Show(perc.ToString("P5"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Maybe its a very dumb question but I hope you can give me some
I'm not very familiar with the console application but i think its kind a
I'm trying to learn Cuda and its very interesting but I'm having problems creating
does anyone know how purevolume.com gets their rounded corners? its very interesting and cross
I am attempting to style a page and its very close but I am
Recently, I has been working with Drools component. I found a very interesting thing.
I know this is more heavy question, but I think its interesting too. It
We had a very interesting problem with a Win Forms project. It's been resolved.
I'm developing a desktop Mac OS X App that saves its very simple data
I developed a web application Using java EE 6, its a very small web

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.