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 ConsoleApp1
- {
- class Program
- {
- static public int[] list = new int [10];
- static public String read;
- static public int x = 0;
- static public int g = 0;
- static public int a;
- static public int b;
- static public int z = 1;
- static public int lenght;
- static void Main(string[] args)
- {
- while (read != "exit")
- {
- if (g == 10)
- {
- lenght = list.Length + 10;
- int[] temp = new int[list.Length];
- Array.Copy(list, temp, 10);
- list = new int[lenght];
- Array.Copy(temp, list, 10);
- }
- A:
- read = Console.ReadLine();
- if (read != "exit")
- {
- list[x] = Int32.Parse(read);
- if (list[x] == 0)
- {
- Console.WriteLine(" Die Zahl muss größer als 0 sein");
- Console.ReadKey();
- Console.Clear();
- goto A;
- }
- }
- g++;
- x++;
- }
- foreach (int i in list)
- {
- System.Console.Write("{0} ", i);
- }
- lenght = list.Length;
- a = list[0];
- while(lenght != 1)
- {
- b = list[z];
- while (b != 0)
- {
- if (a > b)
- {
- a = a- b;
- }
- else
- {
- b = b - a;
- }
- }
- z++;
- lenght = lenght - 1;
- }
- Console.WriteLine("");
- Console.WriteLine("ggT: " + a);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement