NMDanny

תרגיל 3 C#

Dec 16th, 2012
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 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 CSThree
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Console.WriteLine("Type how many flights have you been to?");
  14.             int Flights = int.Parse(Console.ReadLine());
  15.             int Tickets=0, Leftover=0;
  16.             int Distance = 0;
  17.             for (int i = 1; i <= Flights; ++i)
  18.             {
  19.                 Console.WriteLine("Type the distance of your {0} flight in km", i);
  20.                 int SpecDist = int.Parse(Console.ReadLine());
  21.                 Distance = SpecDist + Distance;
  22.                 Tickets = Distance / 3000;
  23.                 Leftover = Distance % 3000;
  24.  
  25.  
  26.             }
  27.             Console.WriteLine("You're eligible for " + Tickets + " flights to Honolulu, and you have accumulated {0}/3000 km for another flight.", Leftover);
  28.  
  29.  
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment