Page 1 of 1

Strange Numbers

Posted: Thu Feb 15, 2018 9:20 pm
by samiul_samin
When I run a usual C programme by codeblock to find the area of a circle,Iget exact value if I put any number.But when I input abcde or any other letter as the radius ,the compiler shows strange numbers.It is different according to inputs.It is not base 16 numbers.What are those strange numbers?

Re: Strange Numbers

Posted: Sun Sep 16, 2018 10:16 pm
by SYED ASHFAQ TASIN
Are you saying that you are getting the actual area by defining radius as 'r' ?
Got that right?But I just tested and its running fine,have you used float?Define 'pi'?Have you used '%f' as format specifier?
If you yet suffering the problem,please share the programme .Then its going to be easy what's going on.
Thank you.

Re: Strange Numbers

Posted: Thu Jan 10, 2019 4:03 pm
by samiul_samin
I have figured out the reason thanks.

Re: Strange Numbers

Posted: Mon Jan 28, 2019 1:40 pm
by SYED ASHFAQ TASIN
What was the mistake(s)?

Re: Strange Numbers

Posted: Tue Jan 29, 2019 6:10 pm
by samiul_samin
SYED ASHFAQ TASIN wrote:
Mon Jan 28, 2019 1:40 pm
What was the mistake(s)?
Those was junk memory like undefined array value.Because I gave wrong datatype.

Re: Strange Numbers

Posted: Mon Oct 25, 2021 6:50 pm
by emeryhen121
There are various reasons why this could be happening.
Have you used float?
Check the datatypes
Check any missing symbols
Have you defined the array? If yes. How have you defined it?
Have you used '%f' as a format specifier?
Another thing, you should always share your code for this sort of work, sometimes the problem is very small that gets ignored by the human eye. Multiple opinions can solve it. You can find good examples here: https://mytutorsource.com/blog/fastest- ... arn-maths/. Moreover, it is easier to identify the problem if it is in front of you.