Hello World! What's wrong | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hello World! What's wrong

We are going to write a program that will calculate the area of ​​a circle. The area enclosed by a circle of radius r is πr², where π (pi) is the constant ratio of the circumference of any circle to its diameter, and r is the radius. The given program declares a constant pi variable with a value of 3.14. Complete the program to take the radius as input, then calculate and output the area of the circle. Sample Input 5 Sample Output 78.5 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 = Console.ReadLine(); double p = pi * (radius * radius ); Console.WriteLine(pi * ( radius * radius )); } } }

1st Aug 2021, 9:03 PM
Каменщик Сан
1 Answer
+ 1
Thanks
2nd Aug 2021, 10:49 AM
Каменщик Сан