Advertisement
Fundamentalen

NumbersInIntervalDividableBy5

Mar 16th, 2014
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using System;
  2.  
  3. class NumbersInIntervalDividableBy5
  4. {
  5.     static void Main()
  6.     {
  7.         Console.Write("Start: ");
  8.         int start = int.Parse(Console.ReadLine());
  9.         Console.Write("End: ");
  10.         int end = int.Parse(Console.ReadLine());
  11.  
  12.         int counter = 0;
  13.  
  14.         for (int i = start; i <= end; i++)
  15.         {
  16.             if (i % 5 == 0)
  17.             {
  18.                 Console.Write(i + " ");
  19.                 counter++;
  20.             }
  21.         }
  22.  
  23.         Console.WriteLine();
  24.         Console.WriteLine("There is {0} numbers dividable by 5!", counter);
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement