Subject: Ada Topic: To Find The Square Root of A Number by Nested Method (CYCLE 5)
Subject: Ada Topic: To Find The Square Root of A Number by Nested Method (CYCLE 5)
Subject: Ada Topic: To Find The Square Root of A Number by Nested Method (CYCLE 5)
SANDHYA.S[S2]
INTRODUCTION:
2
THE VALUE OF THE UPPER LIMIT, THEN THE VALUE OF X GOES ON
INCREMENTING IN THE NEXT TABULATION.
4
5.28 -0.1216
5.29 -0.0159
5.30 +0.09
ALGORITHM DEVELOPMENT
X0
∆1
GET NEXT X
X=X+∆
CHECK IF THE X, AN EXIT
IF YES XU=X
IF NO XL=X
5
2. +VE ROOT FOUND BY TABULATION:
INPUT : N ,∈
OUTPUT : ROOT
{
∆1
XL0 XXL
BACK BACK: X+XL
FL=X2-N
BACK : XX+∆
F=X2-N
IF | F |<Ɛ THEN {ROOTX,EXIT}
ELSE
IF(FL*F)>0 THEN {ROOTX,EXIT}
ELSE
(XLXL),XUX,(FLFL)
FUF,∆=∆/10
GO BACK BACK
}
6
/* REDUCING THE B EQUATION BY THE SYNTHETIC DIVISION*/
STEP 1 .N=0
FOR I=0 TO 3
N=A[I]+(N*B[C])
A[I]=N
FOR END
IF(C=0)THEN
F(X)=A[0] X2+A[1]X+A[2]
ELSE
F(X)=A[0]X+A[1]
IF END
IF(C=2)THEN GO TO STEP 2
ELSE GO TO STEP 3
IF END
ALGORITHM ENDS
7
TIME COMPLEXITY: