mayap

NumbersInRangeDividableByGivenNumber

Apr 11th, 2014
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 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 NumbersInIntervalDividableByGivenNumber
  8. {
  9.     class NumbersInIntervalDividableByGivenNumber
  10.     {
  11.         static void Main()
  12.         {
  13.             Console.WriteLine("Enter first positive number: ");
  14.             uint firstNum = uint.Parse(Console.ReadLine());
  15.  
  16.             Console.WriteLine("Enter bigger positive number: ");
  17.             uint secondNum = uint.Parse(Console.ReadLine());
  18.  
  19.  
  20.             int p = 0;
  21.             for (uint i = firstNum; i <= secondNum; i++)
  22.             {
  23.                 if (i % 5 == 0)
  24.                 {
  25.                     p = p + 1;
  26.                     Console.WriteLine();
  27.                     Console.Write(i);
  28.                     Console.WriteLine();
  29.                 }
  30.             }
  31.             Console.WriteLine();
  32.             Console.WriteLine("{0} numbers", p);
  33.             Console.WriteLine();
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment