Tisho_Todorov

05.ThirdDigitIs7

Oct 12th, 2014
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1. using System;
  2.  
  3. class ThirdDigitIs7
  4. {
  5.     static void Main()
  6.     {
  7.         Console.Write("Waiting for your number:");
  8.         int number = int.Parse(Console.ReadLine());
  9.         int restNumber = number / 100;
  10.         int thirdDigit = restNumber % 10;
  11.         bool isSeven = thirdDigit == 7;
  12.         if (thirdDigit == 7 ? true : false)
  13.             Console.WriteLine("The third digit of your number is 7");
  14.         else
  15.             Console.WriteLine("The third digit of your number is different by 7");
  16.         Console.WriteLine("See you around");
  17.         Console.Title = "Created by T.Todorov";
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment