Methods. Debugging and Troubleshooting Code - Exercises :: 10. Cube Properties
Здравейте,
-Някой би ли ми казал защо джъджа ми дава "Runtime error"
==========================================================
using System;
namespace DemoTrainnig
{
class Program
{
static void Main(string[] args)
{
int s = int.Parse(Console.ReadLine());
string quest = Console.ReadLine();
double result = 0.0;
if (quest == "face") { result = Face(s); }
else if (quest == "space") { result = Space(s); }
else if (quest == "volume") { result = Volume(s); }
else if (quest == "area") { result = Area(s); }
Console.WriteLine($"{result:f2}");
}
static double Face(int s)
{
double Face = Math.Sqrt(2*s*s);
return Face;
}
static double Space(int s)
{
double Space = Math.Sqrt(3 * s * s);
return Space;
}
static double Volume(int s)
{
double Volume = s*s*s;
return Volume;
}
static double Area(int s)
{
double Area = 6 * s*s;
return Area;
}
}
}
Получи се, Мерси!
Моля:) Радвам се и успех!