Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- class DivideBy7and5
- {
- static void Main()
- {
- sbyte five = 5;
- sbyte seven = 7;
- uint intToCheck;
- string divisible = "is divisible by 5 and 7";
- string notDivisible = "is not divisible by 5 and 7";
- Console.WriteLine("Please, enter a positive integer:");
- while (!uint.TryParse(Console.ReadLine(), out intToCheck))
- {
- Console.WriteLine("Please, enter a correct integer");
- }
- Console.WriteLine("{0} {1}", intToCheck, (((intToCheck % seven == 0) && (intToCheck % five == 0)) ? divisible : notDivisible));
- Console.WriteLine("\nPress any key to exit.");
- Console.ReadKey();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement