Algo of Rootz
Algo of Rootz
1. 2. 3. 4. 5.
Read values of a, b and c, if a is zero then stop as we do not have a quadratic, calculate value of discriminant D=b*b-4*a*c if D is zero then there is one root: x=-b/2*a , if D is > 0 then there are two real roots: -b+sqrt(D)/2*a and bsqrt(D)/2*a. 6. if D is < 0 there will be imaginary roots. 7. Print solution.
OUTPUT Enter the value of a b c 1 -5 6 one root is=3.000000 second root is=2.000000
A program to find out the largest number among 10 nos using array.
#include<stdio.h> #include<conio.h> void main() { int a[10],i,big; clrscr(); printf("\n Enter the 10 Nos."); for (i=0; i<10; i++) { scanf("\n%d",&a[i]); } big=a[0]; for (i=1; i<10; i++) { if (big<a[i]) big=a[i]; } printf("\nThe Largest No is %d",big); getch(); }