Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sing System;
- using System.Text;
- class DivisionByFive
- {
- static void Main()
- {
- uint p = 0;
- Console.Write("please write down positive int a = ");
- uint a = uint.Parse(Console.ReadLine());
- Console.Write("please write down positive int b = ");
- uint b = uint.Parse(Console.ReadLine());
- if (a > b)
- {
- a = a + b;
- b = (a - b);
- a = (a - b);
- }
- for (uint i=a;i<=b;i++)
- {
- uint k = i % 5;
- if (k == 0)
- {
- p++;
- }
- }
- Console.WriteLine("the numbers between {0} and {1} that can be divided by 5 with reminder = 0, are 'p'={2}", a, b, p);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement