0

Please check my code for the code project 1 on c# basics

So i was tryiny to figure out a solution for the code project 1 for c# and my code worked on visual studio but not on sololearn. Any idea why? heres my code : namespace SoloLearn { class Program { static void Main(string[] args) { const double pi = 3.14; double radius; double Area; Console.WriteLine("What is the r"); radius = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(radius); radius = radius * radius; Area = radius * pi; Console.WriteLine("This is the Area"); Console.WriteLine( Area); } } }

30th Oct 2022, 3:15 AM
Dimitry Aujour
Dimitry Aujour - avatar
3 Réponses
+ 4
Dimitry Aujour your code appears to work on sololearn .. can you explain what error you are speaking of https://code.sololearn.com/cSjpELKjL5wO/?ref=app
30th Oct 2022, 3:23 AM
BroFar
BroFar - avatar
+ 4
Dimitry Aujour there is one slight correction I did see as if you want to enter a decimal number you need to use Convert.ToDouble(Console.ReadLine()); Not Convert.ToInt32(Console.ReadLine());
30th Oct 2022, 3:31 AM
BroFar
BroFar - avatar
+ 1
That actually helped me bro thank you!
30th Oct 2022, 3:39 AM
Dimitry Aujour
Dimitry Aujour - avatar