View difference between Paste ID: 8RPaMAHc and pPhYb790
SHOW: | | - or go back to the newest paste.
1-
string str = "hello";
1+
using System;
2-
            str += " world";
2+
using System.Collections.Generic;
3-
            str = str + "!!!";
3+
using System.Linq;
4-
            Console.WriteLine(str);
4+
using System.Text;
5
using System.Threading.Tasks;
6-
            StringBuilder builder = new StringBuilder();
6+
7-
            builder.Append("Hello");
7+
namespace _29_12class
8-
            builder.Append(" ");
8+
{
9-
            builder.Append("World");
9+
    class Program
10-
            builder.Append("!!!");
10+
    {
11
        static int num;
12-
            Console.WriteLine(builder.ToString());
12+
        static bool flagIsDouble;
13-
            Console.ReadLine();
13+
14
        static void Main(string[] args)
15
        {
16
            Console.WriteLine("Please enter a number:");
17
            string inputFromUser;
18
            Console.ForegroundColor = ConsoleColor.Blue;
19
            inputFromUser = Console.ReadLine();
20
            num = Int32.Parse(inputFromUser);
21
            //isDouble();
22
            func1();
23
24
            Console.ReadLine();
25
        }
26
        static void func1()
27
        {
28
            int tmp = num;
29
            for (int i = tmp; i > 0; i--)
30
            {
31
                Console.WriteLine(num);
32
                isDouble();
33
                if (flagIsDouble == true)
34
                {
35
                    if (Console.ForegroundColor == ConsoleColor.Red)
36
                    {
37
                        Console.ForegroundColor = ConsoleColor.Blue;
38
                    }
39
                    else
40
                    {
41
                        Console.ForegroundColor = ConsoleColor.Red;
42
                    }
43
                    
44
                }
45
                num--;
46
                
47
            }
48
        }
49
        static void isDouble()
50
        {
51
            if (num%2==0 && num!=1)
52
            {
53
                Console.WriteLine("Is double");
54
                flagIsDouble = true;
55
            }
56
            else
57
            {
58
                Console.WriteLine("Is not double");
59
                flagIsDouble = false;
60
            }
61
62
        }
63
    }
64
}