INDEX Experimen t No 3 4 5 # % ' ( )* )) ), )3 )4
Title CALCULATOR LARGEST AMONG THREE NUMBERS O!EL CHEC"ING $IBONACCI SERIES &RIME NUMBER CHEC"ING ARMSTRONG NUMBER SERIES TEM&ERATURE CONERSION &ALINDROME CHE"ING $ACTORIAL +RECURSION LINEAR SEARCH SORTING BINAR- SEARCH
Experiment No. 3 CALCULATOR Aim. !rite / 01ell 02ript pror/m to re/ to n6m7er0 /n per8orm 7/0i2 /rit1meti2 oper/tion09 oper/tion09 : ; + ; < ; = ;>? Alorit1m :
Step 1: Start Step 2: Read two integers a, b Step Step 3: Calc Calcula ulate te Sum= Sum= a + b Diff= a – b roduct= a ! b Di"=a # b Rem=a $ b Step %: Displa& Sum,Diff,roduct,Di" and Rem Step ': Stop Re06lt. T1e pror/m /0 ritten /n exe26te 0622e0086ll@ /n t1e e0ire o6tp6t i0 o7t/ine Experiment No.4 LARGEST AMONG THREE NUMBERS Aim.
(rite a s)ell script to read t)ree integer numbers and print t)e largest among t)ree numbers* Alorit1m :
Step 1: Start Step 2: Declare "ariables a,b and c* Step 3: Read "ariables a,b and c* Step %: f ab f ac Displa& a is t)e largest number* -lse Displa& c is t)e largest number* -lse f bc Displa& b is t)e largest number* -lse Displa& c is t)e greatest number* Step ': Stop
Re06lt. T1e pror/m /0 ritten /n exe26te 0622e0086ll@ /n t1e e0ire o6tp6t i0 o7t/ine
Experiment No.5 O!EL CHEC"ING Aim.
(rite a s)ell script program to read a c)aracter from .e&board and c)ec. w)et)er it is "owel or not* Alorit1m.
step1: Start step2: Declare "ariable c) * step3: Read t)e "alue of c)* Step%: if /c)==00 c)==0a0 c)==0-0 c)==0e0 c)==00 c)==0i0 c)==00 c)==0o0 c)==040 c) == 0u0 5 t)en Displa& 6 -ntered c)aracter is 7owel 6 8oto step 9 Step': Displa& 6 -ntered c)aracter is not 7owel goto step 9
Step 9: stop Re06lt. T1e pror/m /0 ritten /n exe26te 0622e0086ll@ /n t1e e0ire o6tp6t i0 o7t/ine
Experiment No.# $IBONACCI SERIES Aim.
(rite a s)ell script to print out t)e ;ibonacci series up to a limit* Alorit1m. S<- 1: start S<- 2: Declare "ariables n, a >,b 1, c, i S<- 3: Read "alues of n S<- %: Displa& a, b S<- ': ssign i2 S<- 9: if i ? n t)en goto step @ ot)erwise goto step1> S<- @: calculate c a+b, i i+1 a b, b c Displa& t)e "alue of c goto step 9 S<- 1>: stop Re06lt. T1e pror/m /0 ritten /n exe26te 0622e0086ll@ /n t1e e0ire o6tp6t i0 o7t/ine
Experiment No.% &RIME NUMBER CHEC"ING AIM: STE& 4. s i ? n t)en r =n $ i* ot)erwise go to step B STE& 5. s r=> t)en increment i and A "alue b& i* ot)erwise go to step 9
STE& #. ncrement i "alue b& one STE& %. s A=> t)en print number is prime and go to step 1> STE& '. s A = > t)en print number is not a prime number STE& (. Stop
Re06lt. T1e pror/m /0 ritten /n exe26te 0622e0086ll@ /n t1e e0ire o6tp6t i0 o7t/ine
Experiment No.' ARMSTRONG NUMBER SERIES AIM: and less t)an or eEual to , calculate increment "alue of i* STE& 3. ssign "alue of i to temp and n* STE& 4. ssign "alue of ams eEual to Fero* STE& 5. ()en n not eEual to Fero calculate remn$1>G ams=ams+rem!rem!rem nn#1> STE& #. f temp eEual to ams t)en print t)e "alue of ams* STE& %. <)us for eac) "alue of i, "alues of ams is printed* STE& '. Stop t)e program* Re06lt. T1e pror/m /0 ritten /n exe26te 0622e0086ll@ /n t1e e0ire o6tp6t i0 o7t/ine
Experiment No.( TEM&ERATURE CONERSION
AIM:
(rite a s)ell script to perform Con"ersion of temperature in Celsius to ;a)ren)eit and ;a)ren)eit to Celsius* ALGORITHM: STE& ). Start STE& ,. nput t)e c)oice as 1 or 2 STE& 3. s c)oice is 1 t)en goto step% ot)erwise goto step @ STE& 4. nput temperature in Celsius STE& 5. Calculate ;a)ren)eit ; =//H#'5!c5 +32 STE& #. rint ;a)ren)eit ; and goto step 1> STE& %. nput temperature in ;a)ren)eit STE& '. Calculate Celsius C=//'#H5!/fI3255 STE& (. rint Celsius C STE& )*. Stop Re06lt. T1e pror/m /0 ritten /n exe26te 0622e0086ll@ /n t1e e0ire o6tp6t i0 o7t/ine
Experiment No. )* &ALINDROME CHE"ING Aim. !rite / 01ell 02ript to re/ /n inteer 8in o6t t1e reer0e o8 t1e inteer 60in 86n2tion /n 21e2 1et1er inteer i0 p/linrome or not Alorit1m.
Step 1:start Step2: read n Step 3: cop& n into m for later use* lso, initialiFe rnG Step ':w)ile n is not Fero 1* r = n $ 1> 2* n = n#1> 3* rn = rn!1> + rG Step 9: if m eEual rn t)en t)e number is palindrome* Step @: -lse rint number is not palindrome Step B: stop
Re06lt. T1e pror/m /0 ritten /n exe26te 0622e0086ll@ /n t1e e0ire o6tp6t i0 o7t/ine
Experiment No. )) $ACTORIAL +RECURSION Aim. !rite / 01ell 02ript to re/ /n inteer 8in o6t t1e 8/2tori/l o8 t1e inteer Alorit1m. step1: start Step2: Read a number J n J and fact=1 Step3:if n==1 t)en Return/ 15 Step%: else ;or i=> to i?n ;actorial=fact!fact/nI15 Return/fact5 Step%: stop Re06lt. T1e pror/m /0 ritten /n exe26te 0622e0086ll@ /n t1e e0ire o6tp6t i0 o7t/ine
Experiment No. ), LINEAR SEARCHING Aim. !rite / 01ell 02ript pror/m to re/ /n /rr/@ o8 n inteer0 /n per8orm line/r 0e/r21 oper/tion Alorit1m.
Step 1: Start Step 2: Read t)e arra& of Jn0 elements, f=> Step 3: Read t)e element JK0 to be searc)ed in Step %: Set i to > Step ': if i n t)en go to step 1> Step 9: if LiM = K t)en f=1 and go to step H Step @: Set i to i + 1
Step B: 8o to Step ' Step H: rint -lement K ;ound at indeK i+1 and go to step 11 Step 1>: if f=> t)en rint element not found Step 11: Stop Re06lt. T1e pror/m /0 ritten /n exe26te 0622e0086ll@ /n t1e e0ire o6tp6t i0 o7t/ine
Experiment No. )3 SORTING Aim. !rite / 01ell 02ript pror/m to re/ /n /rr/@ o8 n inteer0 /n 0ort n6m7er in /02enin orer 60in 7677le 0ort te21niF6e Alorit1m.
Step1: Start Step2 : Read t)e number of arra& elements step3: ;or i = > to nI1 Read arra&LiM Step%: ;or i = > to nI1 ;or A = > to nIiI1 f / arra&LiMarra&LA+1M5 t)en
T1e pror/m /0 ritten /n exe26te 0622e0086ll@ /n t1e e0ire o6tp6t i0 o7t/ine Experiment No. )4 BINAR- SEARCH Aim. !rite / 01ell 02ript pror/m to re/ /n /rr/@ o8 n inteer0 /n per8orm 7in/r@ 0e/r21
Alorit1m .
Step 1: Start Step 2: Read t)e arra& a of n elements, f=> Step 3: Sort using an& algorit)m Step %: Read t)e element to be searc)ed in K Step ': Set N=> t)e lower limit and u=nI1 t)e upper limit Step 9: Repeat t)e steps @,B,H,1> until u=N Step @: mid =/N+u5#2 Step B: w)en aLmidM==K f=1 print t)e searc) is successful, displa& t)e position goto step 12 Step H: w)en aLmidM?K N=mid+1 Step 1>:w)en aLmidMK u=midI1 Step 11:if f==> print searc) is unsuccessful Step 12:Stop
Re06lt. T1e pror/m /0 ritten /n exe26te 0622e0086ll@ /n t1e e0ire o6tp6t i0 o7t/ine