0% found this document useful (0 votes)
33 views

And RC Ulls: Lowinj:R Equence of

This document contains pseudocode for several algorithms: 1. An algorithm to read in two values, multiply them by 1.0 and add the results, square both values and add the squares, and check if the answer to step b is greater than step c, printing a statement depending on the result. 2. An algorithm to allow a user to enter the number of values, allow input of the values, calculate the sum and average. 3. An algorithm to read a number and letter, add 5 to the number and place in ANS, subtract 4 from the number if the letter is N and place the result in ANS, and print the results.

Uploaded by

rojei mcbean
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

And RC Ulls: Lowinj:R Equence of

This document contains pseudocode for several algorithms: 1. An algorithm to read in two values, multiply them by 1.0 and add the results, square both values and add the squares, and check if the answer to step b is greater than step c, printing a statement depending on the result. 2. An algorithm to allow a user to enter the number of values, allow input of the values, calculate the sum and average. 3. An algorithm to read a number and letter, add 5 to the number and place in ANS, subtract 4 from the number if the letter is N and place the result in ANS, and print the results.

Uploaded by

rojei mcbean
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

12. "\\.'ri te an :al~ rit hn1 usinj! pseudocn de t.

o do the, fol lowin


J:r sequence of ta 5 ks:
(a ) }{ead in two values
( I nlar k )
(hl ~f ult iply bnrh valu es hy the nuanhcr 1.0 and add the rc~u
lls ( 2 mar ks)
Squ are both valu~~ a1'\d '1dd the ~qtHH'C-S
( 2 mark.<,)
(dJ (~he ck if the ~n~\vcr to (b) is grea ter than the answer to
(c) ( t niar k )
(c) Jf the que stio n c :-lns,v~-r is grc:Hcr. print a statement
indicating that " The squares
h3v c won~·~ .If tht~ question h ansv:er is grea terj print.
a state 1nen t indi catin g thac
"Th e Prod ucts hav e. prod uced a win :'
( 2 mar ks)

Total 8 niarks

1.3. l 1sc a ~tru ctur cd lang uag e to codt~ an algorithm that \vill
find the sum and ave ~ge of a.
coll.e.t:tion of inte gers .

{ a) :\Ho w the user to ente r the quantity of valu es bein g used.


( 1111ark j
(h ) Allo w the user to inpu t the valu es.
( ·2 nnrrks)
(c) c:alc ulal c the s,nn and the aver age. ( 2 n1nrks)

Total S ,narks
16. Wri te an alg orit hm. to per fon n the. follo\ving seq
uen ce of tasks:

(i) Rea d a nur nbc r NlJ!\1~ and a lett er LET

(H ) Add .S to the numbe-r NtT~1 and. place the resu lt in AN


S
t"iii ) If LE 1-: is equaJ to 'i\' t the n suht.r:1ct. 4 front the
num ber NlJl\f and piace th~ result in
ANS
(iv) Pr1nt the resu lts of 'NlHv1 ~tnd L'ET. ( 5 ma ds)
Tot al S marks
13. c: 011sider the foll,) vling 1-,rt-,gra1r11J1ing ·si-atemen~\l:

Tota l= 45
Temp = ~'l''
Total = Total + 90

(a) Identify tile variablc(s),

<bJ Slate the data type(s) of the variable(s).


(c) <.: al.-;•Jlate t.he fC$U) t of ~lcJt'1t
(b ) St al e th e ou tp ut of the fa llo w in g al go
rit hm s. if M A R K is 5-0:
(i) RE .r\ D tv tA R K
IF m ar k < 40
1~HE~ PR IN T 'T he student ha s fa ile d·
EL S.E PR IN T CLet llS se e'
(ii ) \V lI IL E (m ar k< > 50) D O
BEG-IN.
~1 ~U K = M ~~R K + -2
PR I~ T 'Working!
.E ~t )W H I.L E
PRL.'--~ 'T he stude11t t,as pa ss ed '

You might also like