用公式法求方程x2-2x+1=0的两个根.

用公式法求方程x2-2x+1=0的两个根.

答案

解析:

a=1;

b=-2;

c=1;

d=b*b-4*a*c;

if  d<0

   disp(“no solution”);

else

    t=sqrt(d);

    x1=(-b+t)/(2*a);

    x2=(-b-t)/(2*a);

print(%io(2),x1,x2);

end

相关题目

在阶级社会中,真理的根本属性是 A. 阶级性 B. 客观性 C. 主
在阶级社会中,真理的根本属性是 A. 阶级性 B. 客观性 C. 主观性 D. 相对性
What you said just now ____ the matter we are discussing. A. have something to
What you said just now ____ the matter we are discussing. A. have something to do at                    B. has something to do with C. had something to do with           
 ---Mary’s score on the test is the highest in her class.    ---Really? She
 ---Mary’s score on the test is the highest in her class.    ---Really? She ______ have studied very hard.     A. may                     B. ought to            
X、Y、Z是ⅠA--ⅦA族的三种非金属元素,它们在周期表中的位
X、Y、Z是ⅠA--ⅦA族的三种非金属元素,它们在周期表中的位置如右图所示。试完成下列问题: (1)X元素单质的化学式是__________。 (2)Y元素的原子结
I would _____ it if you come to my grandma’s birthday party and say “Hello
I would _____ it if you come to my grandma’s birthday party and say “Hello” to her. A. associate            B. appreciate      C. impress             D. congratulate
 未来新能源的特点是资源丰富,在使用时对环境无污染或污
 未来新能源的特点是资源丰富,在使用时对环境无污染或污染很小,且可以再生。下列属于未来新能源标准的是( )    ①天然气  ②煤  ③核能 
下列检验离子的方法及结论正确的是(   )。A.向某溶液
下列检验离子的方法及结论正确的是(   )。A.向某溶液中滴加AgNO3溶液后产生白色沉淀,说明原溶液中含有Cl-B.向某溶液中滴加BaCl2溶液后产生白色
以下烃中二氯代物只有两种的是(     ) A.(CH3)2CHCH3   
以下烃中二氯代物只有两种的是(     ) A.(CH3)2CHCH3     B.CH3CH2CH3     C. CH3CH2CH2CH3     D.C(CH3)4

最新题目