Guest User

Untitled

a guest
Oct 23rd, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. class Program
  2. {
  3. static void Main(string[] args)
  4. {
  5. int fritz = 0, hans = 0, anz, i = 0;
  6. Console.Write("Wie viele Äpfel haben Fritz und Hans gekauft? ");
  7. anz = Convert.ToInt32(Console.ReadLine());
  8.  
  9. while (anz % 8 != 0)
  10. {
  11. Console.WriteLine("Sorry, aber die Zahl muss durch 8 teilbar sein.");
  12. Console.Write("Gib eine neue Zahl ein: ");
  13. anz = Convert.ToInt32(Console.ReadLine());
  14.  
  15. Console.WriteLine("Runde | Fritz | Hans | Rest |");
  16. Console.WriteLine("-----------------------------");
  17. while (anz > 0)
  18. {
  19. fritz += 5;
  20. hans += 3;
  21. anz -= 8;
  22. i++;
  23. Console.WriteLine("{0,4} {1,4} {2,4} {3,4}", i, fritz, hans, anz);
  24. }
  25. }
  26. }
  27. }
Add Comment
Please, Sign In to add comment