Advertisement
Tisho_Todorov

NumbersInIntervalDividableByGivenNumber

Nov 17th, 2014
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using System;
  2.  
  3. class NumbersInIntervalDividableByGivenNumber
  4. {
  5.     static void Main()
  6.     {
  7.         Console.WriteLine("Plese enter two integer numbers");
  8.  
  9.         Console.Write("Start = ");
  10.         int a = int.Parse(Console.ReadLine());
  11.         Console.Write("End = ");
  12.         int b = int.Parse(Console.ReadLine());
  13.         int count = 0;
  14.         for (int i = a; i <= b; i++)
  15.         {
  16.             if (i % 5 == 0)
  17.             {
  18.                 count++;
  19.             }
  20.         }
  21.         Console.WriteLine("P = {0}", count);
  22.         Console.Write("Comments = ");
  23.         for (int i = a; i <= b; i++)
  24.         {
  25.             if (i % 5 == 0)
  26.             {
  27.                 Console.Write(i + ", ");
  28.             }  
  29.         }
  30.         Console.WriteLine();
  31.         Console.WriteLine("Thank you for your time");
  32.         Console.Title = "Created by T.Todorov";
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement