New course! Every coder should learn Generative AI!
Try a free lesson- 3
Pls help me with this code
Area of circle (C#)
17 Answers
0
Can I see your code?
+ 2
I don't understand
+ 1
Console.WriteLine(pi*radius*radius);
+ 1
console.WriteLine(pi*(r**2))
+ 1
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;
//your code goes here
Console.WriteLine(pi*(r**2));
}
}
}
+ 1
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 = Convert.ToDouble(Console.ReadLine());
double z;
z = pi * Math.Pow(radius, 2);
Console.WriteLine(z);
}
}
}
0
Thanks
0
It doesn't work
0
Perhaps the problem is in another part of the code. Can I see the whole code?
0
You didn't specify a radius value. Judging by the comment in the code, you need to specify keyboard input. And judging by the fact that the radius has a double value, it is already squared
0
Pls help me to solve it
0
Thanks 👍
0
It worked,but pls explain
0
Semilore Akinyode
I advise you to go through the C# material again to refresh your knowledge. You can also look at the training on the Internet for more information.
0
I mean the Math.Pow
0
The Math.pow() method returns the base raised to the power of the exponent, that is, the value of the expression base exponent.
Math.pow(base, exponent)
base - Degree base.
exponent - The exponent to which the base is raised.
0
Thanks so much