解一元二次方程式
ax^2+bx+c=0, x=?
herrDeng網內搜尋
自訂搜尋
Ads
2011年3月17日 星期四
訂閱:
張貼留言 (Atom)
熱門文章
-
url="https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json&date=20220330&stockNo=2330"
-
教育部為提昇全民資安素養與電腦防護能力,本部於101年9月5日至11月5日舉辦「全民資安素養自我評量」活動,請在活動期間內踴躍上網檢測資訊安全素養認知程度,並有機會參與抽獎,詳情請參閱活動網站(網址: https://isafe.moe.edu.tw/event
-
python pandas對黃金、外匯匯率的爬蟲練習,並使用matplotlib.pyplot的函數plot, scatter做資料視覺化處理,採用numpy的統計函數,分析黃金價格波動與歐元走勢的關聯。
-
Python C C++ 2 pointer速解Leetcode 2337 Move Pieces to Obtain a String 多日Leetcode的問題都可用2-pointer法來解,今日2337. Move Pieces to Obtain a String也不例...
-
你會用C的算子sizeof?
46 則留言:
import java.util.*;
class smile
{
public static void main(String [] argv)
throws Exception
{
Scanner input=new Scanner(System.in);
int a=input.nextInt();
int b=input.nextInt();
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
double d2 = Math.sqrt(d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<=0)
{
System.out.println(s+"<0");
return;
}
System.out.println(Math.sqrt((float)d));
System.out.println(d<8.);
System.out.println("x1="+x1+",x2="+x2);
}
}
import java.util.*;
class qq{
public static void main(String [] argv)
throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("please key a=");
int a=input.nextInt();
System.out.print("please key b=");
int b=input.nextInt();
System.out.print("please key c=");
int c=input.nextInt();
float d = b*b - 4*a*c;
String s ="判別式";
double d2 = Math.sqrt(d);
double x1 = (-b + d2) / (2*a);
double x2 = (-b - d2) / (2*a);
System.out.println(a+"x^2+"+b+"x+"+c+"=0"+s+"="+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
System.out.println(Math.sqrt((float)d));
System.out.println("x1="+x1+",x2="+x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class qq
{
public static void main (String[] arg)
{
int a,b,c;
Scanner input = new Scanner(System.in);
System.out.println("輸入a");
a = input.nextInt();
System.out.println("輸入b");
b = input.nextInt();
System.out.println("輸入c");
c = input.nextInt();
float d = b*b - 4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+"=0"+s+"="+d);
if (d<0)
{
System.out.println(s+"<0");
return;
}
double k,m,n;
System.out.println(Math.sqrt((float)d));
k = Math.sqrt((float)d);
m = (-b+k)/(a*2);
n = (-b-k)/(a*2);
System.out.println("方程式解為"+m+"和"+n);
}
}
import java.util.*;
class qq
{
public static void main (String[]arg)throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if (d<0)
{System.out.println(s+"<0以後都不");
return;
}
System.out.println(Math.sqrt((float)d));
/* float d2=math.sqrt(d);
x1=(-b+d2)/(2*a);
x2=(-b-d2)/(2*a);
*/
}
}
import java.util.*;
class qq
{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if (d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class qq
{
public static void main(String[]arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("");
int a,b,c;
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
double d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((double)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class qq
{
public static void main (String [] arg) throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+"="+d);
if (d<0)
{
System.out.println(s+"<0");
return;
}
System.out.println(Math.sqrt((float)d));
double d2=Math.sqrt(d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class qq
{
public static void main (String [] arg)throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print ("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+"="+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
System.out.println(Math.sqrt((float)d));
double d2=Math.sqrt(d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class qq
{
public static void main (String[]arg)throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if (d<0)
{System.out.println(s+"<0以後都不");
return;
}
System.out.println(Math.sqrt((float)d));
/* float d2=math.sqrt(d);
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
*/
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class qq
{
public static void main (String[]arg)throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print ("a=");
a=input.nextInt();
System.out.print ("b=");
b=input.nextInt();
System.out.print ("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
System.out.println(Math.sqrt((float)d));
System.out.println(d!=25);
if(d<0)
{
System.out.println(s+"<0");
return;
}
System.out.println(Math.sqrt((float)d));
double d2=Math.sqrt(d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("a=");
int a=input.nextInt();
System.out.print("b=");
int b=input.nextInt();
System.out.print("c=");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class qq
{
public static void main (String[]arg)throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if (d<0)
{System.out.println(s+"<0以後都不");
return;
}
System.out.println(Math.sqrt((float)d));
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class qq
{
public static void main(String [] arg) throws Exception
{
int a, b, c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+"="+d);
if (d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class qq
{
public static void main (String[]arg)throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if (d<0)
{System.out.println(s+"<0以後都不");
return;
}
System.out.println(Math.sqrt((float)d));
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class qq
{
public static void main(String[]arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("");
int a,b,c;
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
double d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((double)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class qq
{
public static void main(String[]arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("");
int a,b,c;
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
double d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((double)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class qq
{
public static void main(String [] arg)throws Exception
{ int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b= input.nextInt();
System.out.print("c=");
c= input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if (d<0)
{System.out.println(s+"<0");
return;
}
System.out.println(Math.sqrt((float)d));
double d2=Math.sqrt(d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1) ;
System.out.println(x2) ;
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class qq
{
public static void main(String[] arg)throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x"+c+s+d);
if (d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class qq
{
public static void main (String [] arg)
{
int a,b,c;
Scanner input =new Scanner (System.in);
System.out.print("輸入a=");
a= input.nextInt();
System.out.print("輸入b=");
b= input.nextInt();
System.out.print("輸入c=");
c= input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if (d<0)
{
System.out.println(s+"<0");
return;
{
System.out.println(Math.sqrt((float)d));
double d2=Math.sqrt(d);
double x1=(-d+d2)/(2*a);
double x2=(-d-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
}
}
import java.util.*;
class qq
{
public static void main(String [] arg)throws Exception
{
int a,b,c;
Scanner input=new Scanner(System.in);
System.out.print("a=");
a=input.nextInt();
System.out.print("b=");
b=input.nextInt();
System.out.print("c=");
c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if (d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class qq
{
public static void main(String[]arg)throws Exception
{
int a,b,c;
Scanner input =new Scanner(System.in);
System.out.print("a=");
a= input.nextInt();
System.out.print("b=");
b= input.nextInt();
System.out.print("c=");
c= input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+"0"+s+"="+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sprt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class qq
{
public static void main(String[]arg)throws Exception
{
int a,b,c;
Scanner input =new Scanner(System.in);
System.out.print("a=");
a= input.nextInt();
System.out.print("b=");
b= input.nextInt();
System.out.print("c=");
c= input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+"0"+s+"="+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sprt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2"+b+"x+"+c+s+d);
if(d<0)
{System.out.println(s+"<0");
return;
}
double d2=Math.sqrt(d);
double X1=(-b+d2)/(2*a);
double X2=(-b-d2)/(2*a);
System.out.println(X1);
System.out.println(X2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class qq
{
public static void main(String[]arg)throws Exception
{
int a,b,c;
Scanner input =new Scanner(System.in);
System.out.print("a=");
a= input.nextInt();
System.out.print("b=");
b= input.nextInt();
System.out.print("c=");
c= input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+"0"+s+"="+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.println(x1);
System.out.println(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class qq
{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if (d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java {
public static void main(String[]arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System .out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d>0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class java{
public static void main(String [] arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
import java.util.*;
class qq{
public static void main(String[]arg)throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("輸入a");
int a=input.nextInt();
System.out.print("輸入b");
int b=input.nextInt();
System.out.print("輸入c");
int c=input.nextInt();
float d=b*b-4*a*c;
String s="判別式";
System.out.println(a+"x^2+"+b+"x+"+c+s+d);
if(d<0)
{
System.out.println(s+"<0");
return;
}
double d2=Math.sqrt((float)d);
double x1=(-b+d2)/(2*a);
double x2=(-b-d2)/(2*a);
System.out.print(x1);
System.out.print(x2);
}
}
張貼留言