EasyManuals Logo
Home>Casio>Desktop>Z-1

Casio Z-1 User Manual

Casio Z-1
126 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #93 background imageLoading...
Page #93 background image
93
/* Quadratic equation */
/* #include <stdio.h> */
/* #include <math.h> */
main(){
double a,b,c,D,q,r;
scanf(“%lf %lf %lf“,&a,&b,&c);
D=b*b-4.0*a*c;
if (d>=0){
q=(-b+sqrt(D))/a/2.0;
r=(-b-sqrt(D))/a/2.0;
printf(“%If, %If¥n“,q,r);
}
else{
r=sqrt(-D)/a/2.0;
q=-b/a/2.0;
printf(“%lf+%lfi “,q,r);
printf(“%lf-%lfi¥n“,q,r);
}
}
The variables “a”, “b” and “c” correspond to the “a”, “b”, and “c” in the quadratic
equation, while the “D” variable is the “D” of the discriminant. Variables “q” and “r” are
used for the two solutions. Note that all of the variables are specified as “double”,
meaning that they are for double-precision floating point values.
Note that the % construction in the scanf() function is “%lf”. The “f” portion specifies a
floating-point value, while the “l” stands for long, and means that the integer part of
the value is longer than normal.
Relational operators
The condition “D>=0” is called a relational operator. This tells the computer to
compare the value assigned to variable “D” with 0. If the value of “D” is greater than
or equal to 0, a value of 1 (TRUE) is returned to indicate true. If it is less than zero, a
0 (FALSE) is returned to indicate false. The following are the other relational
operators that can be used with C.
Operator
Example
Meaning
>
<
>=
<=
==
!=
i>j
i<j
i>=j
i<=j
i==j
i!=j
True (1) if i is greater than j, false (0) if not.
True (1) if i is less than j, false (0) if not.
True (1) if i is greater than or equal to j, false (0) if i is less than j
True (1) if i is less than or equal to j, false (0) if i is greater than j
True (1) if i is equal to j, false (0) if not.
True (1) if i is not equal to j, false (0) if it is.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Casio Z-1 and is the answer not in the manual?

Casio Z-1 Specifications

General IconGeneral
BrandCasio
ModelZ-1
CategoryDesktop
LanguageEnglish

Related product manuals