BorisSimeonov

Numbers in Interval Dividable by Given Number

Nov 17th, 2014
181
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. class NumbersDividableByNumber
  4. {
  5.     static void Main()
  6.     {
  7.         int startNum = int.Parse(Console.ReadLine());
  8.         int endNum = int.Parse(Console.ReadLine());
  9.         int counter = 0;
  10.         Console.Clear();
  11.         for (int cnt = startNum; cnt <= endNum; cnt++ )
  12.         {
  13.             if(cnt % 5 == 0)
  14.             {
  15.                 Console.Write(counter == 0 ? "{0}" : ",{0}", cnt);
  16.                 counter++;
  17.             }
  18.         }
  19.         if(counter == 0)
  20.         {
  21.             Console.Write("-");
  22.         }
  23.         Console.WriteLine("\r\nCount: {0} numbers.", counter);
  24.     }
  25. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×