Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Write an expression that checks for given integer if its third digit from right-to-left is 7.
- using System;
- class ThirdDigit
- {
- static void Main()
- {
- Console.Write("Enter number a = ");
- string numberA = Console.ReadLine();
- int a = int.Parse(numberA);
- int b = a / 100;
- int c = b % 10;
- if (c == 7)
- {
- Console.WriteLine("true");
- }
- else
- {
- Console.WriteLine("false");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment