C#求方程的根,题目要求无实根时带i.using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{class Program{static void Main(string[] args){string i = Console.ReadLine();string[] str =

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/03 13:38:47
C#求方程的根,题目要求无实根时带i.using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{class Program{static void Main(string[] args){string i = Console.ReadLine();string[] str =

C#求方程的根,题目要求无实根时带i.using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{class Program{static void Main(string[] args){string i = Console.ReadLine();string[] str =
C#求方程的根,题目要求无实根时带i.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string i = Console.ReadLine();
string[] str = i.Split();
int a = int.Parse(str[0]);
int b = int.Parse(str[1]);
int c = int.Parse(str[2]);
double k=b*b-4*a*c;
double j=Math.Sqrt(k);
double x1,x2,j2;
if (j > 0)
{
x1 = (-b + j) / 2.0 * a;
x2 = (-b - j) / 2.0 * a;
Console.WriteLine("x1={0} x2={1}",x1,x2);
}
else if (j == 0)
{
x1 = (-b) / 2.0 / a;
x2 = (-b) / 2.0 / a;
Console.WriteLine("x1={0} x2={1}",x1,x2);
}
else
{
}
}
}
}
写了一半了,就是无实根不会写.顺便看看我前面的有没有错?

C#求方程的根,题目要求无实根时带i.using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{class Program{static void Main(string[] args){string i = Console.ReadLine();string[] str =
double k=b*b-4*a*c; //后面开始分类讨论一下就可以了
int i=0;//标记位 ,记录是否有虚根,有的话1,没有就是0
if(k

C#求方程的根,题目要求无实根时带i.using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication1{class Program{static void Main(string[] args){string i = Console.ReadLine();string[] str = 已知关于X的方程x2+(k+2i)x+2+ki=0无实根,求实数K范围. 已知向量a,b是不共线向量,关于实数X的方程ax^2+bx+c(c成为已知向量,△=b^2-4ac)的根的情况为A.必有实根B.有一实根或无实根C.没有实根D.△≥0时有实根,△<0时无实根 用c++求方程 xlg(x)=1 的实根的近似值,要求误差不超过0.001. C语言 求方程aX^2+bX+c=0解,其中a.b.c由键盘输入.若方程无实根,输出没有实数根,否则输出实根用比较简单的语句完成 已知方程lg(x-1)+lg(3-x)=lg(a-x) (1)若方程有且只有一个根,求a的取值范围 (2)若方程无实根,求a的取值范围请写出具体解题过程题目是说只有一个根,并不是说两根相等~ 如果一个分式方程做出来的所有根都是增根 那这个方程方程是无解还是无实根 若方程x2-2ax 1=0的根在区间【2,3】无实根,求实数a的取值范围 若方程x²-2ax+1=0的根在区间【2,3】无实根,求实数a的取值范围 方程ax^2+(1+2i)x-2a(1-i)=0有实根复数方程有实根 求实数a的取值 下列说法中有且只有一个成立:(1)方程x的方+mx+1=0有两个相异负根;(2)方程4x的方+4(m-2)x+1=0无实根.求实数m的取值范围.注意:这个题目是出现在交集、并集一课里的,肯定和交集或并集有 无理方程:若方程k-根号下(6x+7)=6无实根,求k的范围.如何分类讨论? 用C#求数字累加题目要求的是要计算s=1+(1+2)+1+2+3)```````+(1+2+3+````n)是用C#求 求教高数题目当p>0时,方程x∧3+px+q=0的实根的个数,求教导, 一道高二数学题目,关于复数的已知关于x的方程x^2+(k+2i)x+2+ki=0有实根,求这个实根和实数k的值.还有一道与之相似的:若关于x的方程x^2+(1+2i)x-(3m-1)i=0有实根,则纯虚数m=_______第一道我不会但第二 若方程x+(5+i)x+4+pi=0(p属于C)有实根,求p和方程的根 已知方程x2+(2+i)x+4ab+(2a-b)i=0(a,b是实数)有实数根`,求实根的取值范围? 关于x的方程 x^2-6x+(a+2)|x-3|+9-2a=0 有两个不等实根,求a的取值范围△=0时 和 △> 0时都和题目说的条件不符啊,题目说的是有两个不等实根。△=0时的实根有一个,△>0 时有4个啊?