Guest User

Untitled

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