Code C#: Giải phương trình bậc nhất (Console)

Người đăng: share-nhungdieuhay on Thứ Năm, 28 tháng 2, 2013


using System; 
namespace PhuongTrinhBacNhat{
    class Program {
        static void Main(string[] args) {
            Console.Write("Nhap he so a :");
            int a = int.Parse(Console.ReadLine());
            Console.Write("Nhap he so b :");
            int b = int.Parse(Console.ReadLine());
            if (a == 0)
                if (b == 0)
                    Console.WriteLine("Phuong trinh co vo so nghiem");
                else
                    Console.WriteLine("Phuong trinh vo nghiem ");
            else{
                int ketqua = -b / a;
                Console.WriteLine("Phuong trinh co nghiem la x = {0}",
                ketqua.ToString());
            }
            Console.ReadKey();
        }
    }
}

{ 0 nhận xét... read them below or add one }

Đăng nhận xét