The idea of programming might sound like a frightening task, but don’t worry. We designed this blog so that you can get your feet wet without stepping into the deeper complexities of the programming.
This Blog is dedicated to all those people who want to learn the most basic but important Programming Language'C Programming'.
If done step wise C language is easy and fun to learn.
So lets get started.
Start reading from the First Post to understand C programming.You may read a desired topic from the labels.
Press Ctrl+D to add this page to your Favourites/Bookmarks for further reference.
Note:Your comments,queries and suggestions are welcome.Feel free to post them in the the comment boxes available after every post.

Search C Programs,Compilers,etc.

Tuesday, March 17, 2009

C Program to calculate roots of quadratic equations

C Program to calculate roots of quadratic equations
This is a simple C program to calculate roots of quadratic equations.A function sqrt() is used in this program to find the square root.
#include
main()
{
int a,b,c,d;
float root1,root2;
printf("Enter the values of a,b,c");
scanf("%d%d%d",&a,&b,&c);
d=b*b-4*a*c;
root1=((-b)+sqrt(d))/(2*a);
root2=((-b)-sqrt(d))/(2*a);
printf("root1=%f & root2=%f",root1,root2);
}


0 comments: