-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patht1i1.cs
37 lines (36 loc) · 951 Bytes
/
t1i1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace T1I1
{
class t1i1
{
static void Main(string[] args)
{
try
{
Console.WriteLine("Geben sie die Zahl ein deren Kehrwert errechnet werden soll");
double zahl = Convert.ToDouble(Console.ReadLine().Trim());
if (zahl == 0.0)
{
t1i1.fehler("Division durch 0 nicht möglich");
}
else
{
Console.WriteLine("Kehrwert: "+(1 / zahl));
}
}
catch (Exception e)
{
t1i1.fehler(e.Message);
}
}
public static void fehler(string msg)
{
Console.WriteLine("");
Console.WriteLine("FEHLER: ");
Console.WriteLine(msg);
}
}
}