program to find the roots of a quardratic equation
Answer / valli
/***********
quadratic equationis ax^2+bx+c=0
************8/
#include<math.h>
main()
{
int a,b,c,d,r1,r2;
printf("enter the values of a,b,c");
scanf("%d%d%d",&a,&b,&c)'
d=(b*b)-(4*a*c);
if(d<0)
{
printf("the roots are imaginary");
d=sqrt(-d);
printf("\nroots are %d+i%d",-b/(2*a),d/(2*a));
printf("\n%d-i%d",-b/(2*a),d/(2*a));
}
else
{
d=sqrt(d);
r1=(-b+d)/(2*a);
r2=(-b-d)/(2*a);
printf("the roots of the equation are %d %d ",r1,r2);
}
}
Is This Answer Correct ? | 3 Yes | 3 No |
What is a const pointer?
What are the types of i/o functions?
how can write all 1to 100 prime numbers using for loop,if and break ?
Calculate 1*2*3*____*n using recursive function??
how can i sort numbers from ascending order and descending order using turbo c..
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list
What is the acronym for ansi?
Write a program using two-dimensional array that lists the odd numbers and even numbers separately in a 12 input values.
What is the explanation for cyclic nature of data types in c?
Write a C program to help a HiFi’s Restaurant automate its breakfast billing system. Your assignment should implement the following items: a. Show the customer the different breakfast items offered by the HiFi’s Restaurant. b. Allow the customer to select more than one item from the menu. c. Calculate and print the bill to the customer. d. Produce a report to present your complete program and show more sample output. Assume that the HiFi’s Restaurant offers the following breakfast menu: Plain Egg $2.50 Bacon and Egg $3.45 Muffin $2.20 French Toast $2.95 Fruit Basket $3.45 Cereal $0.70 Coffee $1.50 Tea $1.80
what will happen if you free a pointer twice after allocating memory dynamically ?
What is a static function in c?