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;
- namespace _29_12class
- {
- class Program
- {
- static int num;
- static bool flagIsDouble;
- static void Main(string[] args)
- {
- Console.WriteLine("Please enter a number:");
- string inputFromUser;
- Console.ForegroundColor = ConsoleColor.Blue;
- inputFromUser = Console.ReadLine();
- num = Int32.Parse(inputFromUser);
- //isDouble();
- func1();
- Console.ReadLine();
- }
- static void func1()
- {
- int tmp = num;
- for (int i = tmp; i > 0; i--)
- {
- Console.WriteLine(num);
- isDouble();
- if (flagIsDouble == true)
- {
- if (Console.ForegroundColor == ConsoleColor.Red)
- {
- Console.ForegroundColor = ConsoleColor.Blue;
- }
- else
- {
- Console.ForegroundColor = ConsoleColor.Red;
- }
- }
- num--;
- }
- }
- static void isDouble()
- {
- if (num%2==0 && num!=1)
- {
- Console.WriteLine("Is double");
- flagIsDouble = true;
- }
- else
- {
- Console.WriteLine("Is not double");
- flagIsDouble = false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement