TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
A X
NA
18
9k
Converting Celsius to Farenheit
Jan 12 2018 3:16 AM
Hello I have created a simple program that converts celsius to farenheit but, for some reason the math operation i used is not giving me the correct result. celsius to farenheit is
F = 9/5 * C + 32. I broke down the problem and the error lies with the fraction (9/5). For some reason this calculation gives me a result of 1. Obviously im missing something here. Any help would be appreciated and thank you. here is my code...
private void btnF_Click(object sender, EventArgs e)
{
double cel, total;
cel = Double.Parse(txtC.Text);
total = 9/5 * cel + 32;
lblResult.Text = total.ToString();
}
would i have to cast the variable to float? and if i do cant that cause loss of data?
do I have to use a Math method? what am i doing wrong?
Reply
Answers (
2
)
Use of Get Set property with Session Sate.
How to delete file opened by a Canvas