In this post, we will see how to resolve I couldn’t enter fractional value by my keyboard and catching exception
Question:
I wrote simple console program to calculate expression but I couldn’t enter fractional data to my values.I dont know where is mistake maybe because I am new in c# but I would be glad if someone could help me. Btw maybe the problem is in double.TryParse() method?using System;
Best Answer:
By fractional data, I assume you enter something like3/4
. If so, you cannot parse it directly. You need to separate out the numerator and denominator and calculate the value.please refer this link Convert a text fraction to a decimal
If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com
Leave a Review