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;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = 0;
- Console.Write("Zadejte první číslo: ");
- int i1 = Int32.Parse(Console.ReadLine());
- Console.Write("Zadejte druhé číslo: ");
- int i2 = Int32.Parse(Console.ReadLine());
- while (true)
- {
- if (i2 > i1)
- {
- n = i2;
- i2 = i1;
- i1 = n;
- }
- if (i1 % i2 == 0)
- break;
- else
- {
- i1 = i1 % i2;
- }
- }
- if (i2 == 1)
- Console.WriteLine("NSD neexistuje");
- else
- Console.WriteLine("NSD je " + i2);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement