Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # include <stdio.h>
- # include <math.h>
- int main(void)
- {
- double a, b, c;
- double r1, r2;
- printf("Input coefficient 1:");
- scanf("%lf, &a");
- printf("Input coefficient 2:");
- scanf("%lf, &b");
- printf("Input coefficient 3:");
- scanf("%lf, &c");
- if((pow(b, 2) - 4*a*c) <= 0){
- printf("Error");
- }else {
- double v1 = sqrt(pow(b, 2) - 4*a*c);
- r1 = (v1-b)/(2*a);
- r2 = (-v1-b)/(2*a);
- printf("Root1: %lf \n", r1);
- printf("Root2: %lf \n", r2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement