Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- int fritz = 0, hans = 0, anz, i = 0;
- Console.Write("Wie viele Äpfel haben Fritz und Hans gekauft? ");
- anz = Convert.ToInt32(Console.ReadLine());
- while (anz % 8 != 0)
- {
- Console.WriteLine("Sorry, aber die Zahl muss durch 8 teilbar sein.");
- Console.Write("Gib eine neue Zahl ein: ");
- anz = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Runde | Fritz | Hans | Rest |");
- Console.WriteLine("-----------------------------");
- while (anz > 0)
- {
- fritz += 5;
- hans += 3;
- anz -= 8;
- i++;
- Console.WriteLine("{0,4} {1,4} {2,4} {3,4}", i, fritz, hans, anz);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment