Results 1 to 3 of 3
Thread: .
Hybrid View
-
9th October 2013 20:51 #1Registered User
Join Date: Jan:2010
Location:
Posts: 116
.
.. (- 54
) 1-2 . ax^2 +bx+c=0 . :
, , (1.000000) .000 , . , ( int , float) .Code:#include<stdlib.h> #include<math.h> #include<stdio.h> #include<Windows.h> int main() { // int a,b,c,D,x,x1,x2; SetConsoleOutputCP(1251); printf(" a:"); scanf("%f", &a); printf(" b:"); scanf("%f", &b); printf(" c:"); scanf("%f", &c); // if(a==0) { printf(" !\n"); x=b/c; printf("x=%f\n",x); system("pause"); return 0; } D = b*b - 4*a*c; printf("d=%f \n", D); // D if (D<0) { printf(" !\n"); } else if (D>0) { x1 = (-b + sqrt(D))/(2*a); printf("x1=%f \n", x1); x2 = (-b - sqrt(D))/(2*a); printf("x2=%f \n", x2); } else if (D==0) { printf(" :\n"); x = (-b + sqrt(D)/(2*a)); printf("x1=x2=%f\n",x); } system("pause"); return 0; }
: - int . , - float (4/5^2+....) ..
.
-
9th October 2013 21:29 #2
printf("%.3f", x1);
x1 float, a .3f
3 7,556. C - , C++ -.Code:#include <stdio.h> #include <stdlib.h> int main() { float x1 = 7.55552; printf("%.3f", x1); return 0; }De jure de facto - !
, , , , , !
-
9th October 2013 23:32 #3Registered User
Join Date: Jan:2010
Location:
Posts: 116
.




Reply With Quote
Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in