I have the following code:
double f = (1500 / 3000);
MessageBox.Show(string.Format("{0:F2}",f));
I expect to get 0.50 as my output but I get 0.00. What am I doing wrong? Please help me understand how formatting works.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
You are dividing integers.
Change to