Advertisement
SSkrev

Numbers in Interval Dividable by Given Number

Mar 17th, 2014
554
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. using System;
  2.  
  3. class NumbersInInterval
  4. {
  5.     static void Main()
  6.     {
  7.         Console.Write("Start= ");
  8.         int a = int.Parse(Console.ReadLine());
  9.         Console.Write("Stop= ");
  10.         int b = int.Parse(Console.ReadLine());
  11.         for (int i = a; i <= b; i++)
  12.         {
  13.             if (i % 5 == 0)
  14.             {
  15.                 Console.Write(i);
  16.                 if (i < b - 2)
  17.                 {
  18.                     Console.Write(",");
  19.                 }
  20.             }
  21.  
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement