+ 10

Area of a circle c# challenge solution

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { const double pi = 3.14; double radius; radius = Convert.ToDouble(Console.ReadLine()); double area = pi * (radius * radius); Console.WriteLine(area); //your code goes here } } }

6th Jul 2021, 5:57 PM
cameron
cameron - avatar
11 odpowiedzi
+ 2
Is it also possible to write the code with ()² or ^2? I already know the writing goes like ... (radius * radius) but i am wondering if there is a more easy way of coding it ... Thx ;)
31st Aug 2021, 8:33 AM
FromAlex TotheAnder
FromAlex TotheAnder - avatar
+ 3
cameron Thanks!
4th Nov 2021, 9:25 PM
YourMinecraftGuy
YourMinecraftGuy - avatar
+ 1
Yeah theres definitely more ways, this is just a simple plain version for understanding. Possibly, but the ^ operator is not able to be applied to double and int operands normally.
31st Aug 2021, 10:57 AM
cameron
cameron - avatar
+ 1
YourMinecraftGuy is there a specific part you dont understand? If you really dont understand any of it at all, id suggest startimg the course/program from the start and really reading the information, it really explains in the best possible way you will find online. And perhaps google for short begginner tutorials im order to see how and why certain things get done and placed. Just say if you need more help
3rd Nov 2021, 10:10 AM
cameron
cameron - avatar
+ 1
also can use var area = pi*radius*radius. I also got a correct answer.
20th Apr 2022, 2:59 AM
Abdullah Ishak
Abdullah Ishak - avatar
+ 1
Why is it radius * radius? That makes no sense to me. You only need to multiply radius and pi together
5th Nov 2022, 11:36 PM
Chris
Chris - avatar
0
I guess you should use Math.PI constant to avoid floating point precision error by using only Pi with two decimals (or even any other different Pi value)...
6th Jul 2021, 6:13 PM
visph
visph - avatar
0
I don´t understand anything...
3rd Nov 2021, 9:32 AM
YourMinecraftGuy
YourMinecraftGuy - avatar
0
Hello I having trouble with the area of the circle project. how do I get all 5 case test at once I already solved all five by one at a time and also by displaying them all at once any tips to help.
27th Nov 2021, 1:34 AM
Jaden Martin
Jaden Martin - avatar
0
Thr exact code attached in this post solves for all cases at once
27th Feb 2022, 11:58 AM
cameron
cameron - avatar
0
other solution using System; namespace ConsoleApp3 { class Program { static void Main(string[] args) { double pi = 3.14; double radius; radius = Convert.ToDouble(Console.ReadLine()); Console.WriteLine(pi * (radius*radius)); } } }
5th Jun 2022, 2:22 PM
mateo marina
mateo marina - avatar