Advertisement
Guest User

NumbersInIntervalDividableby5

a guest
Mar 20th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. class NumbersInIntervalDividableby5
  2.     {
  3.         static void Main()
  4.         {
  5.             int start = int.Parse(Console.ReadLine());
  6.             int end = int.Parse(Console.ReadLine());
  7.  
  8.             int realStart = (start / 5) * 5 + 5;
  9.             int realEnd = (end / 5) * 5;
  10.             int count = (realEnd - realStart) / 5 + 1;
  11.             Console.WriteLine(start % 5 == 0 ? ++count : count);
  12.         }
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement