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)
![Đặng Trần Nhật Minh [T2008A]](https://www.gravatar.com/avatar/ee8dc5a777ad26f3a962e86c233437cf.jpg?s=80&d=mm&r=g)
Đặng Trần Nhật Minh
2021-06-03 13:33:49
using System;
public class Program
{
public static void Main()
{
float a, b, x;
Console.WriteLine("Input a: ");
a = float.Parse(Console.ReadLine());
Console.WriteLine("Input b: ");
b = float.Parse(Console.ReadLine());
if (a == 0)
{
if (b == 0) Console.WriteLine("Infinite Solutions!");
else Console.WriteLine("No Solutions!");
}
else
{
x = (-b) / a;
Console.WriteLine("The Solution is x = {0}", x);
}
}
}
![Do Trung Duc [T2008A]](https://www.gravatar.com/avatar/2973ac07124f066b4605c535e8d39a99.jpg?s=80&d=mm&r=g)
Do Trung Duc
2021-05-18 04:44:01
using System;
namespace Lesson1
{
class Program
{
static void Main(string[] args)
{
float a, b, x;
Console.WriteLine("Nhap a = ");
a = Int32.Parse(Console.ReadLine());
Console.WriteLine("Nhap b = ");
b = Int32.Parse(Console.ReadLine());
if (a==0) {
if (b==0){
Console.WriteLine("phuong trinh vo so nghiem");
}
else
{
Console.WriteLine("phuong trinh vo nghiem");
}
}
else
{
x = -b / a;
Console.WriteLine("phuong trinh co nghiem x = {0}", x);
}
}
}
}
![nguyễn Sử [T2008A]](https://www.gravatar.com/avatar/47487be2776ac2ec915b0936ef7ab5ae.jpg?s=80&d=mm&r=g)
nguyễn Sử
2021-05-14 09:05:54
using System;
namespace ax___b___0
{
class Program
{
static void Main(string[] args)
{
float z;
Console.WriteLine("nhap x");
float x = float.Parse(Console.ReadLine());
Console.WriteLine("nhap y");
float y = float.Parse(Console.ReadLine());
if (x == 0)
{
if (y == 0)
Console.WriteLine("phuong trinh vo so nhiem");
else
{
Console.WriteLine("phuong trinh vo nhiem");
}
}
else
{
z= -y / x;
Console.WriteLine("nhiem:{0}", z);
}
}
}
}
![Nguyễn Tiến Đạt [T2008A]](https://www.gravatar.com/avatar/b5819cd0adc95c727c7ad0c2bcf6098b.jpg?s=80&d=mm&r=g)
Nguyễn Tiến Đạt
2021-05-14 08:56:21
using System;
public class Program
{
public static void Main()
{
float a, b;
a = Convert.ToInt32(Console.ReadLine());
b = Convert.ToInt32(Console.ReadLine());
if (a == 0) Console.WriteLine("PTVN");
else Console.WriteLine("x = {0}", -b / a);
}
}
![hainguyen [T2008A]](https://www.gravatar.com/avatar/32855ce6db55d60134d830aee06b41e5.jpg?s=80&d=mm&r=g)
hainguyen
2021-05-14 08:45:40
using System;
namespace Test
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Nhap x, y ");
int x, y;
float c;
x = int.Parse(Console.ReadLine());
y = int.Parse(Console.ReadLine());
if (x == 0)
{
if (y == 0)
Console.WriteLine("Phuong trinh vsn");
else
Console.WriteLine("PTVN");
}
else
{
c = -y / x;
Console.WriteLine("PT co 1 nghiem : " + c);
}
}
}
}
![vuong huu phu [T2008A]](https://www.gravatar.com/avatar/307a5cf29780afab49706dc8b15b86c6.jpg?s=80&d=mm&r=g)
vuong huu phu
2021-05-14 08:31:59
using System;
namespace baitap
{
class Program
{
static void Main(string[] args)
{
float t;
Console.WriteLine("nhap so a");
float a = float.Parse(Console.ReadLine());
Console.WriteLine("nhap so b");
float b = float.Parse(Console.ReadLine());
if (a == 0)
{
if (b == 0)
{
Console.WriteLine("Phuong trinh vo so nghiem");
}
else
{
Console.WriteLine("Phuong trinh vo nghiem");
}
}
else {
t = -b / a;
Console.WriteLine("nghiem = " + t);
}
}
}
}
![NguyenHuuThanh [T1907A]](https://www.gravatar.com/avatar/035e4f4fed661b8e1c3e066e43cd5e41.jpg?s=80&d=mm&r=g)
NguyenHuuThanh
2020-05-18 04:57:41
using System;
namespace Bai_Tap_C__sharp
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Nhap vao 2 so");
int a, b;
float c;
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
//ax + b = 0
if ( a == 0 )
{
if (b == 0)
Console.WriteLine("Phương trình vsn);
else
Console.WriteLine("Phuong trinh vo nghiem");
}
else
{
c = (float)((-b) / a );
Console.WriteLine("Phương trình có 1 no" + c);
}
}
}
}
![Trần Anh Quân [T1907A]](https://www.gravatar.com/avatar/7e3a8fe30cedd711f426fc59a9d48efc.jpg?s=80&d=mm&r=g)
Trần Anh Quân
2020-05-14 20:22:25
using System;
namespace ptb2
{
class Program
{
static void Main(string[] args)
{
Console.Write("nhap a:");
int a = int.Parse(Console.ReadLine());
Console.Write("Nhap b:");
int b = int.Parse(Console.ReadLine());
if (a == 0)
if (b == 0)
Console.WriteLine("phuong trinh 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();
}
}
}
![Phạm Ngọc Minh [T1907A]](https://www.gravatar.com/avatar/9fa44938f36838ed4b4ac8e30e070c74.jpg?s=80&d=mm&r=g)
Phạm Ngọc Minh
2020-05-14 08:20:08
using System;
namespace database
{
class Program
{
static void Main(string[] args)
{
Console.Write("nhap a:");
int a = int.Parse(Console.ReadLine());
Console.Write("Nhap b:");
int b = int.Parse(Console.ReadLine());
if (a == 0)
if (b == 0)
Console.WriteLine("phuong trinh 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();
}
}
}
![Đỗ Văn Huấn [T1907A]](https://www.gravatar.com/avatar/04c40301dd027839d265b3c3c9dc6e6b.jpg?s=80&d=mm&r=g)
Đỗ Văn Huấn
2020-05-14 02:50:46
using System;
namespace Phuongtrinhbacnhat
{
class Program
{
static void Main(string[] args)
{
Console.Write("Moi ban nhap so a: ");
float a = float.Parse(Console.ReadLine());
Console.Write("Moi ban nhap so b: ");
float b = float.Parse(Console.ReadLine());
if (a==0)
{
if (b == 0)
{
Console.WriteLine("Phuong trinh vo so nghiem.");
return;
}
Console.WriteLine("Phuong trinh vo nghiem.");
}
else
{
Console.WriteLine("Phuong trinh co 1 nghiem -b/a = " + (-b/a));
}
}
}
}