Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.54 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConU15E1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int a, hilf1, hilf2, hilf3, summe;
  14.             string temp;
  15.             do
  16.             {
  17.                 summe = 0;
  18.                 Console.Write("Zahlenfolge: ");
  19.                 temp = Console.ReadLine();
  20.                 a = Convert.ToInt32(temp);
  21.                 for (int i = 1; i <= a; i++)
  22.                 {
  23.                     Console.WriteLine();
  24.                     Console.Write("Zahl1: ");
  25.                     hilf1 = Convert.ToInt32(a);
  26.                     if (temp.ToUpper() == "STOP")
  27.                     {
  28.                         break;
  29.                     }
  30.                     Console.Write("Zahl2: ");
  31.                     hilf2 = Convert.ToInt32(a);
  32.                     if (temp.ToUpper() == "STOP")
  33.                     {
  34.                         break;
  35.                     }
  36.                     Console.Write("Zahl3: ");
  37.                     hilf3 = Convert.ToInt32(a);
  38.                     if (temp.ToUpper() == "STOP")
  39.                     {
  40.                         break;
  41.                     }
  42.                     summe = hilf1 + hilf2 + hilf3;
  43.                 }
  44.                 Console.Write("Summe: " + summe);
  45.                 Console.Write("Wollen Sie das Programm wiederholen J oder N: ");
  46.             }
  47.             while (Console.ReadLine().ToUpper() == "J");
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement