program to find the roots of a quadratic equation
Answer Posted / sachin kumar
#include<stdio.h>
int main()
{
int a,b,c,r1,r2,disc;
printf("Enter the number of a,b,c:");
scanf("%d\n%d\n%d",&a,&b,&c);
disc= b*b-4*a*c;
if(disc<0)
{
printf("Roots are imaginary");
}
else if(disc==0)
{
r1=(-b)/a;
r2=r1;
printf("The Root1 and Root2 are equal and roots are
%d\n,%d",r1,r2);
}
else
{
r1=(-b+((b*b)-4*a*c))/2*a;
r2=(-b-((b*b)-4*a*c))/2*a;
printf("The Root1 and Root2 are %d\n,%d\n",r1,r2);
}
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange
Hi, i have a project that the teacher want a pyramid of numbers in C# or java...when we click a button...the pyramid should be generated in a listbox/or JtextArea...and the pyramid should have the folowing form: 1 232 34543 4567654 567898765 67890109876 7890123210987 890123454321098 90123456765432109 0123456789876543210 Plz help with codes...didn't find anything on the net.
How to palindrom string in c language?
To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']
write a program for area of circumference of shapes
Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?
Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines
Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??
could you please send the program code for multiplying sparse matrix in c????
why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?
Develop a routine to reflect an object about an arbitrarily selected plane
write a c program to input initial & final time in the format hh:mm and find the time intervel between them? Ex inputs are initial 06:30 final 00:05 and 23:22 final 22.30
how to programme using switch statements and fuctions, a programme that will output two even numbers, two odd numbers and two prime numbers of the users chioce.
What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?
What is full form of PEPSI