C # get started practice

1, print string.

2, call the simple method.

the using KingTest01;
 the using the System; 

namespace KingTest01 

{ 
    class Program1. 
    { 
        static  void Main1 ( String [] args) 
        { 
            Console.WriteLine ( " thousandths 1234 is " + 1234 / 1000 ); 
            Console.WriteLine ( " percentile 1234 It is " + 1234 / 100 % 10 ); // 12.34 
            Console.WriteLine ( " out of 1234 bit is " +1234 / 10 % 10 ); // 123.4 
            Console.WriteLine ( " sub bit 1234 is " + 1234 % 10 ); 
            Console.WriteLine ( " 10 is a power of 2 " + ( 2 << 10 )); 

            Program1. Test = new new Program1. (); 
            test.year ( 2020 ); 
            test.calculate ( . 11 ); 
            test.calculate1 ( 10 , 20 is ); 

        } 

        public void year(int a)
        {
            if (a % 4 != 0)
            {
                Console.WriteLine(a + "不是闰年");
            }
            else
            {
                Console.WriteLine(a + "是闰年");
            }
        }

        public void calculate(int a)
        {
            Console.WriteLine(a + "" + (a % 2 == 0 ? " Even number " : " odd " )); 

        } 
        public  void calculate1 ( int A, int B) 
        { 
            Console.WriteLine (A + " and " + B + " larger is the " + (A> B? A: B)); 

        } 
    } 
}

 

Guess you like

Origin www.cnblogs.com/BruceKing/p/11542067.html