You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
980 B
C#
36 lines
980 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
namespace Dosenrechner
|
|
{
|
|
class Dosenrechner
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
double hoehe, durchmesser, radius;
|
|
double flaeche, volumen;
|
|
const double pii = 3.141589265;
|
|
|
|
//Eingabe
|
|
Console.Write("Geben Sie eine Höhe an: ");
|
|
hoehe = Convert.ToDouble(Console.ReadLine());
|
|
Console.Write("Geben Sie einen Durchmesser an: ");
|
|
durchmesser = Convert.ToDouble(Console.ReadLine());
|
|
|
|
//Berechnungen
|
|
radius = durchmesser / 2;
|
|
|
|
volumen = 2 *pii * radius * radius * hoehe;
|
|
flaeche = 2 * pii * radius * (radius * hoehe);
|
|
|
|
//Ausgabe
|
|
Console.Write("Volumen: "+volumen+" Oberflaeche: "+flaeche);
|
|
Console.ReadLine();
|
|
}
|
|
}
|
|
}
|