Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- int antallB = 0;
- int maksAntall = 30;
- int stasjoner = 4;
- Console.Title = "Buss";
- for (int stasjon = 1; stasjon <= stasjoner; stasjon++){
- Console.WriteLine("På stasjon: " + stasjon + " stiger det på: ");
- try{
- antallB += Convert.ToInt32(Console.ReadLine());
- }
- catch (Exception e){
- Console.WriteLine("En feil har oppstått: " + e.Message);
- }
- if (antallB > maksAntall){
- antallB = maksAntall;
- }
- Console.WriteLine("Antall passasjerer på bussen: " + antallB);
- }
- Console.WriteLine("Siste holdeplass er nå nådd. Antall passasjerer på bussen: " + antallB);
- Console.ReadKey();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement