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;
- namespace ConsoleApp4
- {
- class Program
- {
- static void Main(string[] args)
- {
- int inputOdd = int.Parse(Console.ReadLine());
- bool isOdd = inputOdd % 2 != 0;
- while (true)
- {
- if (inputOdd % 2 != 0)
- {
- if (inputOdd < 0)
- {
- Console.WriteLine($"The number is: {Math.Abs(inputOdd)}");
- break;
- }
- Console.WriteLine($"The number is: {inputOdd}");
- break;
- }
- else if (isOdd == false)
- {
- Console.WriteLine("Please write an odd number.");
- inputOdd = int.Parse(Console.ReadLine());
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment