This web page requires JavaScript to be enabled.

JavaScript is an object-oriented computer programming language commonly used to create interactive effects within web browsers.

How to enable JavaScript?

Ví dụ mẫu môn Lập trình quản lí – tuần 2

10cth1-2 September 17, 2012 Nam Le 0

[codes=c#]using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace B1_E1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(“Xin chao den voi khoa hoc Lap Trinh Quan Ly”);
            Console.Write(“Ban ten gi”);
            string s = Console.ReadLine();
            Console.Write(“Ban bao nhieu tuoi”);
            string s1 = Console.ReadLine();
            int tuoi = Convert.ToInt32(s1);
            Console.WriteLine(“Chao ban {0} {1} tuoi”,s,tuoi);
            Console.ReadLine();
        }
    }
}[/codes]

[codes=c#]using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace B1_RefP
{
    class Program
    {
        static void Main(string[] args)
        {
            int a=8,b=0,y;
            Console.WriteLine(“Hoan vi hai so:”);
            Console.WriteLine(“a={0}\nb={1}\n thanh:”, a, b);
            Program p = new Program();
            p.swap(ref a, ref b);
            Console.WriteLine(“a={0}\nb={1}”, a, b);
            p.subtraction(a, out y);
            Console.WriteLine(“y={0}”,y);
            int s;
            p.param(out s,1,2,3,4);
            Console.WriteLine(“Tong tu 1..3 s={0}”, s);
            Console.ReadLine();
        
        }
        void swap(ref int a, ref int b)
        {
            int tg;
            tg = a;
            a = b;
            b = tg;
        }
        void subtraction(int a, out int y)
        {
            y = a-2;
        }
        void param(out int result, params int[] arr)
        {
            result = 0;
            for (int i = 0; i < arr.Length; i++)
                result += arr[i];

        }
    }
}[/codes]


Last modified on December 4th, 2020 at 3:17 am

Nam Le
lequocnam



0 responds

Leave a Reply

Your email address will not be published. Required fields are marked *