By GokiSoft.com|
15:16 14/05/2021|
C Sharp
Viết chương trình ax + b = 0 bằng C#, C Sharp
Viết chương trình ax + b = 0 bằng C#, C Sharp
Tags:
Phản hồi từ học viên
5
(Dựa trên đánh giá ngày hôm nay)
![hoangduyminh [T1907A]](https://www.gravatar.com/avatar/33675cc9fc3762fd323389a179aa047f.jpg?s=80&d=mm&r=g)
hoangduyminh
2020-05-13 09:17:10
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace T1908A
{
class Program
{
static void Main(string[] args)
{
Console.OutputEncoding = Encoding.UTF8;
Console.WriteLine("Nhập vào a: ");
float a = float.Parse(Console.ReadLine());
if (a == 0)
{
Console.WriteLine("a phải khác 0");
}
else
{
Console.WriteLine("Nhập vào b: ");
float b = float.Parse(Console.ReadLine());
float x = -b / a;
Console.WriteLine("{0}x + {1} = 0 \n=> x = {2}", a, b, x);
}
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace T1907A
{
class Program
{
static void Main(string[] args)
{
System.Console.WriteLine("Hello World!");
Console.ReadKey();
}
}
}
B1
![lê văn phương [T1907A]](https://www.gravatar.com/avatar/a07ddfb51e1e7189c76b4e42dbdbcddc.jpg?s=80&d=mm&r=g)
lê văn phương
2020-05-13 09:14:49
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PhuongTringBac1
{
class Program
{
static void Main(string[] args)
{
Console.OutputEncoding = Encoding.UTF8;
Console.WriteLine("Nhập vào a: ");
float a = float.Parse(Console.ReadLine());
if (a == 0)
{
Console.WriteLine("a phải khác 0");
}
else
{
Console.WriteLine("Nhập vào b:");
float b = float.Parse(Console.ReadLine());
float x = -b / a;
Console.WriteLine("{0}x + {1} = 0 \n=> x = {2}", a,b,x);
}
Console.ReadKey();
}
}
}
![Trần Ngọc Hải [T1907A]](https://www.gravatar.com/avatar/9f7a27af52cbf0d52c32019e1354d60a.jpg?s=80&d=mm&r=g)
Trần Ngọc Hải
2020-05-13 09:12:31
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PTB1
{
class Program
{
static void Main(string[] args)
{
Console.OutputEncoding = Encoding.UTF8;
Console.WriteLine("Nhập vào a: ");
float a = float.Parse(Console.ReadLine());
if (a == 0)
{
Console.WriteLine("a phải khác 0");
}
else
{
Console.WriteLine("Nhập vào b: ");
float b = float.Parse(Console.ReadLine());
float x = -b / a;
Console.WriteLine("{0}x + {1} = 0 \n=> x = {2}", a, b, x);
}
Console.ReadKey();
}
}
}
![Phí Văn Long [T1907A]](https://www.gravatar.com/avatar/5db166b7b74443c5c221e4c0068d6da9.jpg?s=80&d=mm&r=g)
Phí Văn Long
2020-05-13 09:06:16
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PTbac1
{
class Program
{
static void Main(string[] args)
{
Console.OutputEncoding = Encoding.UTF8;
Console.WriteLine("Nhập vào a : ");
float a = float.Parse(Console.ReadLine());
if (a == 0)
{
Console.WriteLine("a phải khác 0");
}
else
{
Console.WriteLine("Nhập vào b : ");
float b = float.Parse(Console.ReadLine());
float x = -b / a;
Console.WriteLine("{0}x + {1} = 0 \n => x = {2}", a, b, x);
}
Console.ReadKey();
}
}
}
![thienphu [T1907A]](https://www.gravatar.com/avatar/c4573ea65e411176c1852fd8584f1ab1.jpg?s=80&d=mm&r=g)
thienphu
2020-05-13 09:04:44
using System;
using System.Text;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.OutputEncoding = Encoding.UTF8;
bool ischeck = true;
while (ischeck) {
Console.WriteLine("Nhập vào a: ");
float a = float.Parse(Console.ReadLine());
if (a == 0)
{
Console.WriteLine("a phải khác 0");
}
else
{
Console.WriteLine("Nhập vào b: ");
float b = float.Parse(Console.ReadLine());
float x = -b / a;
Console.WriteLine("{0}x + {1} = 0 \n=> x = {2}", a, b, x);
ischeck = false;
}
}
Console.ReadKey();
}
}
}