Advertisement
sylviapsh

Integer Check if it can be divided by 5 & 7

Dec 28th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. using System;
  2. class IntCheckDivisionOf5and7
  3. {
  4.   static void Main()
  5.   {
  6.     //Write a boolean expression that checks for given integer if it can be divided (without remainder) by 7 and 5 in the same time.
  7.  
  8.     Console.Write("Enter an integer number:");
  9.     int numberToCheck = int.Parse(Console.ReadLine());
  10.     bool divisionResult = ((numberToCheck % 35) == 0);
  11.     Console.WriteLine("The number {0} {1} be divided by 5 and 7 at the same time.", numberToCheck, divisionResult ? "can" : "cannot");
  12.   }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement