C CompDummy Member Joined Dec 5, 2020 Messages 5 Programming Experience Beginner Dec 5, 2020 #1 Hello, I am creating a simple program to calculate the area of a triangle. But the problem is, I can't enter a decimal number and the result is not a decimal number either. How should I solve this?
Hello, I am creating a simple program to calculate the area of a triangle. But the problem is, I can't enter a decimal number and the result is not a decimal number either. How should I solve this?
Skydiver Staff member Joined Apr 6, 2019 Messages 7,863 Location Chesapeake, VA Programming Experience 10+ Dec 5, 2020 #2 It sounds like you are using int or long as your data type. Try using double, float, or decimal as your data type. Out of curiosity, what book or tutorial are you using to learn C#? This is something that should have been covered relatively early. Upvote 0 Downvote
It sounds like you are using int or long as your data type. Try using double, float, or decimal as your data type. Out of curiosity, what book or tutorial are you using to learn C#? This is something that should have been covered relatively early.
N NoUserHere Well-known member Joined Sep 5, 2018 Messages 2,138 Programming Experience 10+ Dec 5, 2020 #3 Show your code and put your code in code tags when posting. Specifically the code relative to your issue and we can take a goosy gander for you. Upvote 0 Downvote
Show your code and put your code in code tags when posting. Specifically the code relative to your issue and we can take a goosy gander for you.
N NoUserHere Well-known member Joined Sep 5, 2018 Messages 2,138 Programming Experience 10+ Dec 5, 2020 #4 I don't know why people post sentences without any substance or code, and expect us to know what is wrong... Upvote 0 Downvote
I don't know why people post sentences without any substance or code, and expect us to know what is wrong...