Issue with Area of a Circle Test | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Issue with Area of a Circle Test

I solved 5 of the 6 Test Inputs, but it errors on Test Input #2 = 6.4 Can anyone help me understand why? The error is very confusing. Here is my code: const double pi = 3.14; double radius = Convert.ToInt32(Console.ReadLine()); double area = (radius*radius)*pi; Console.WriteLine(area);

17th Feb 2022, 1:49 AM
Jonah Nelson
1 Answer
+ 3
6.4 is a float value. Don't convert input to integer.
17th Feb 2022, 2:55 AM
Simon Sauter
Simon Sauter - avatar