C# program for finding how many numbers are devidable by 5 in give range
- by user1639735
My task is: Write a program that reads two positive integer numbers and prints how many numbers p exist between them such that the reminder of the division by 5 is 0 (inclusive). Example: p(17,25) = 2.
Console.Write("Enter min: ");
int min = int.Parse(Console.ReadLine());
Console.Write("Enter max: ");
int max = int.Parse(Console.ReadLine());
Console.WriteLine("The numbers devidable by 5 without remainder from {0} to {1} are: ",min,max);
for (int i = min; i <= max; i++)
{
if (i % 5 == 0)
{
Console.WriteLine(i);
}
}
This prints out the numbers that are devidable by 5 in the range...How do I count how many are there and print the count in the console? Thanks.