Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 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 CV_13
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int číslo = 0;
  14. int[] pole = new int[10000];
  15. Console.WriteLine("Zadejte dělenec:");
  16. int vstup1 = int.Parse(Console.ReadLine());
  17. Console.WriteLine("zadejte dělitel:");
  18. int vstup2 = int.Parse(Console.ReadLine());
  19.  
  20.  
  21. while (vstup1 > 0)
  22. {
  23. vstup1 -= vstup2;
  24. číslo++;
  25.  
  26. if(vstup1 >0)
  27. {
  28. pole[číslo] = vstup1;
  29. }
  30.  
  31. }
  32. if (pole[číslo-1] == vstup2)
  33. {
  34. Console.WriteLine($"výsledek je {číslo} zbytek je: 0");
  35. }
  36. else
  37. {
  38. Console.WriteLine($"výsledek je: {číslo-1} zbytek je: {pole[číslo - 1]} "); //zbytek = pole[číslo-1]
  39. }
  40. Console.ReadLine();
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement