Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication3
- {
- class Program
- {
- private static int zahl1, zahl2;
- static void Main(string[] args)
- {
- while (true)
- {
- Console.Write("Zahl 1: ");
- string eingabe1 = Console.ReadLine();
- if (Int32.TryParse(eingabe1, out zahl1))
- {
- Console.Write("Zahl 2: ");
- string eingabe2 = Console.ReadLine();
- if (Int32.TryParse(eingabe2, out zahl2))
- {
- Console.WriteLine("Summe: " + Summe(zahl1, zahl2));
- }
- else
- {
- Console.WriteLine("Keine gültige Zahl");
- }
- }
- else
- {
- Console.WriteLine("Keine gültige Zahl");
- }
- Console.ReadLine();
- Console.Clear();
- }
- }
- private static int Summe(int z1, int z2)
- {
- return z1 + z2;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement