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

Algorithm & Flowchart - Rudiments of Computer Science (XI)

The document outlines the steps involved in programming, including problem definition, design, coding, testing, debugging, and documentation phases. It emphasizes the importance of following a structured approach and using algorithms to solve problems effectively. Additionally, it discusses the significance of flowcharts in visualizing program logic.

Uploaded by

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

Algorithm & Flowchart - Rudiments of Computer Science (XI)

The document outlines the steps involved in programming, including problem definition, design, coding, testing, debugging, and documentation phases. It emphasizes the importance of following a structured approach and using algorithms to solve problems effectively. Additionally, it discusses the significance of flowcharts in visualizing program logic.

Uploaded by

Eshita Das
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 12
os = CHAPTER feflalulane ste Malt Nacsiatstas that take some input and produce an output. Though the code generated cre of eta ney age wns, ewe te rocadure should bm oo pes Pon He even problem and shoul be Independent of the angi noe tused. This general seneral nto cave 2 ven problem stepwise, based On sore Procedure or logic. The language isa tool to fas ee he res. For example prepare a cp of tea the genera procedure is: put some water container, ight stove and put the container on 2. Check ifthe water Is Baling 2 Gat. wat forthe water to boll and again goto step 2, ese goto step + x puto the stove and add some tea leaves and walt for 2 minutes pour the iquor Into a cup, add sugar and milk and serve se soveresut cn alo be achieved using 2 pan or 9 Kt, a gas purer of n of 0. powdered mk ve rest can ao be PcNen case though the general procedure remains the same but the ecual insure and deta of geting the result may Vary. fsa second example take the problem of calculating the result of y= 3x4/2.+ 4°(3— 2) Teopt the result we have to star the calculation frm te let and follow the BEDMAS rule as shown below: 1. Look forthe presence of any Brackets 3 ar brackets are present, calcute the part inside the bracket, goto step 1 3. Look for any Exponentiation (power) operation 2 Fran exponentiation operation is present, perform the exponentiation, go to step 3 5, Look for any Division operation §._ Ifa division operation is present, perform the division, goto step 5 7. took for any Multiplication operation 8. fa multiplication operation is present, perform the multiplication, go to step 7 9, Look for any Addition operation 10. If an addition operation is present, perform the addition, go to step 9 11. Look for any Subtraction operation 12, Ifa subtraction operation is present, perform the subtraction, go to step 11 The value of the expression can be calculated correctly by following the above set of rules In the order e written, If the order Is changed, then the output will be different. Thus the order of the steps is important in such a procedure. Moreover we have ‘completed the calculation in a finite n jumber of steps. Once this rule - been fv can perm the calculation either manually, or using a calculator or using a et 1 Le, by using different means. However, whatever be the means, thi i SO RSaeRiCn of Um TIGOn ans, the procedure remains the same | 7 nase a Problem ‘and then to convert it to a computer program to solve the problem, the steps that need | Different : " ifferen phases of programming he Program Definition Phase: rk out what must be done This Is the first step In the programming proces I ie we erent Inputs inthe frm varias problem and roblem t may be requ Iving the constants seg ah ony from garmula organs worked out, Poet the output. The form of the de roots of 2 quadratic equatl As an example, consider the femllar problet of finding the Ter rricients of the variable tenet What’ Involves fist Identifying the Input vars, ST peel termula o relationship i rena | int term, The next irement is to know ve have to know the tyPes of outpass 4 this case the Unc uonstip shoud BE used. Finally DUS ty may arise Le. real-equal,, real-unequal or imaginary problem It s not always ey 8 ice Program Design Phase ae comes the ‘how’ part. Since there can be more than on€ way orthe quadratic ‘equation probi | find the best solution to a particular problem. ‘As for the ‘how 7 ofthe eater than Ze of feet fist find the best solute” Fmnant and then check wet its value 7h square root of the scrim ne | Then depending upon the value of the discriminant wwe have tO inant ang find the roots using the Sridharacharya reationshiP saward to the start : Sometimes it may be helpful to assume the sole” and start wor Oa ful, For starting concn, | ee Ecalsokuon Is not known even 2 Suess the slution 20 o'(as 22=4) and 1, fd th | square root of 5 we assume the squat oot to be a number we than 3 (a, | 3%=9) and square that number to find how close it isto the ex 7 oe | 7 i .se include the development | Some importar Implement the logic inthe problem design pha e development of, | algorithm, Pachore aeeudo-code i pe problem definition. 19 the following sections we vj have a detailed discussion on the above methodologies. ] % Program Coding Phase: i Joped, then the logic to soh [Sree the algorithm, flowchart or pseudo-code fr problem has been developed, th solve the | problem ha been established. The next phase Is the esl coding of the program i.e. to translate the le | into program code in a step by step ‘manner using a particular programming language. Depending on the | choice of the programming language the program syntax will be different, though the main logic and | structure remains the same. Core shouldbe taken so 2s to minimise syntactical 27d Jogical errors. The compiler or the interpreter ition or interpretation. Bat it is sometimes Care so deni syntactical errors during the time of compl | Sai aitfictt and time consuming to detect and debug 9 logical error. i ‘e Program Testing & Debugging Phase: vhe ve to check if the program runs correctly i.e, whether weg | the program has been written we ha the desired outputs. For a good program, even it vnvalid inputs are supplied the program should be abet “hem. All sets of inputs or input conditions are to be given to check if they produce prove tier tne program does not run exactly as expected then try to find out if there are any syn ois, whether you have missed out on any punctuation, used any reserved word as a variable name 2 Next try to find out if there are any logical errors. To tackle such problems try to follow the execution of the program step by step. ‘Working out the program by hand (dry run) before attempting to execute it with aval | | | | input data, can also be helpful. heProgram Documentation Phase: fam documentation sul be considered as an Integral part of programming. Proper documentation i hel 2 ea designed fs naan sro by ging trough the Ising. Ts cn help both te | program ata later date. person who wants to inspect the source code | | to make a program code properly understandable, co | », comments i “Rate cuerity eraaceen ieeet aur 7 | Ehould be used so that at any point in the program one snoin debugging the program as It becomes a lot easier to coairae ie othe) vale TH [Algorithm and Flowonert cE we nave to oton 2 spate st of son Pr oY cau: poser sane en gone of # eR \ Sree cade 3 nf mize rm ne olen ene sno may De we, Pe of areas and unable Vnstructions designed iu ired result IS obtained within & gorithm. Tt should be: ‘sequence of is a seauenctay sequence tre Jes jesired result form the 2 rithm is applied, 27d ich a way that if + | Definition of ‘Algorithm n assignment or store OPE! are two values, ra is used to comp: jing the average for variable number of Je called Sum to zero |. yunt the number of inputs, |. th = Indicates 2 nage AS: in contrast, the = symbol c:s0 um + INP variable Sum Le. Sum = Si seep: narease te coun step6t_ If more numbers 2 it ion go to Step3, else go to SteP7 7: Calculate the average AVS 25 the Sum divided by the count C Le. AVG I= sum/C \ step8: Print the average AVO and terminate program program design Is specific and each time the numbers are changed, the program also Tn the second case the program Is & general one | nthe first case the In Ue wp be changed to accommoddte the new numbers. feable to input any number of inputs € find the average. rn the first but it clearly states the steps that and the user | second algorithm is a litle complicated tha program to carry out the average and hence is 2 tan be seen that the mean be taken In case we want to Prepare a general pater ehoie. Thus the same problem can have different algorithms and different procedures. \ Examples pimple: Ngortm toad wo numbers: ‘step. Input a ee step2. Input b a | Step3. sum za +b nee Step4. Print sum step5. Stop Example-2: Aigorthm to derive the ide of a value) we have to first check if the | To derive the absolute value of a number (Le. the .e, the positive magnitu soe ic postive or negative. If the number is postive the absolute value is the same as the number itself. | If the number Is negative then the absolute value is the negative of the given number. Stepi, Input num Step2, If num < 0, then a num := (-1) * Gos mcrae = (-1) * num | Step4. Stop absolute value of any number. ee P1-7-3 Part 4: Chapter 7 | nor od8 RGus: ‘Algorithm to check fa number is eve ces a 0 remainder, ese its odd, tn m1 1d hence prodt ider of dit tha vumber Is even If It is evenly dlvsible by 2 aN et the remainder of dividing a p.,, Temalnder of 1 1g obtained, Modulo operation 1 USed TO FF tne division is 2, nme nother number ¥, Thus 14 (modulo) 3's 2, a5 the r ‘Stepii 1 Is used to y Step2: tt urn (modulo) 2.<>0, then {the symbol <> Is used to denote ‘not “al tay Print “Odd Number” ‘Step3: Else a. Print "Even Number” Step4: stop Samples: gorithm to nd the percentage of mars obtained in Physics Maths, ard Compute Scene 2 student, out ofa total of 300 marks. Stepi. (arible sum 2580 ee ‘Step2. Input Phy Ca mart of Step3. sum := sum + Phy (aad mars ops pam ‘Step4. Input Math (lo mt su) ‘Step5. sum := sum + Math (Adi TS Oe et scence) | Step6. Input coms (ing mers Oo ee aoe to Step7. sum := sum +Coms (Ad marks of computer science to sum) Step8. Percentage := sum*100/300———_—___ Step9. Print Percentage Step3p, Stop fmple-5: The same problem can also be done for a variable number of subjects, using a counter; Step. sum:=0 (Declare variable for sum calculation and initialise it to 0) | Step2. count := 0 (Declare variable for counting number of subjects and initialise it to 0) | Step3. Input number of subjects: num (Input the total number of subjects to use) | Step4. Input marks of a subject: marks (input marks for a given subject) | Steps. sum := sum + marks (Add marks to sum total) Steps. count | Step7. If count <> num then (Uf count value is not equal to num then loop) | a. Goto Stepa count +1 (Increase count value by 1) Step8. percentage := [sum/(num*100)] *100 Step9. Print percentage Stepi0. Stop eae algorithm shows the use of a ‘loop’, ea section of the code that gets repeated (steps 4 to7) mple-6: A shopping mall is giving ciscount on items purchased. If the purchased item Is a shit he (710% discount is given. Ifthe Item is a trouser, then discount given is 20%. If item is a cap then 5% dscurt | Is given. Write down the algorithm for the net purchase amount. | Step: Input item type: Item Step2: Input Item price: Price Step3: If Item = “shirt” then a. Amount := Price ~ Price * 10 / 100 Step4: If Item = “trouser” then a. Amount := Price ~ Price * 20 / 100 StepS: If Item = “cap” then a. Amount := Price ~ Price * 5 / 100 Step6: Print Amount Step7: Stop Note the use of the =" operator to compare the value stored in Item with other values. . 4-7-4 reciente of Computer Science Algorithm and Flowchart, a cxampt-yr os we avn the apr to generate te sees 123,456 rmeserGeis generated by adding 1 to the previous term In the series, starting from 1, grepi. count i= 2 (Declare counter and initialse It to 2) Seep2._ Input the total numberof terms to print: MN ssrep3. Loop while count <= N (Continue loop as long as count<=N) a. Print count b. count := count +2 (increment count value by 1) es series unt. Note that the steps 3a and generat have used a different form of the loop stateme! e steps 3a Togenerate the Seng as count value Is less than or equal to N This ‘expressed by using the ‘Loop 3b &t Gatement. The steps 32 and 3b loop as tong as the Condition count<=N Is true. The moment the tion becomes fal oop ends and stops repeating the statements 3a and 3b. Example; 8: Alasfithm to generate the series 12, 23, 3%, 4, 5%, 6 .. and get its sum up to N terms. Te sc similar to the previous one, however Instead of the count value, the square of the count value is getting added here. ‘Siepi: count i= 2 Step2: sum := 0 “Stap3: Input the total number of terms to add: N * Step4: ‘Loop while count <= N a, sum = sum + count*count b. count := count + 4 (Uncrement count value by 1) ‘Step5: Print sum Step6: Stop xample-9: Let us now write down the algorithm to print the first N odd numbers ie.1,3,5,7,9 « Stepi: count := 1 (Declare variable for counting number of terms and Initialise it to 1) Step2i Term i= 1 (Declare variable for series term and Intialse It fo fist term value he. ) ‘Step3: Input the total number of terms to print: N (Declare counter and Initialise It to 1) (Continue loop as long as count<=N) When an algorithm is expressed in a pictorial manner ‘Step4:_ Loop while count <= N (Continue loop as long as count<=N) with special a. Print Term ee bh. Termi= Term +2 (Add 2 to current value of term to get the next term value) different types of instructions, then —— Vnen air sigorithm Is expressed in a pictorial manner with special symbols to indicate the different & types of Instructions, then it Is called a flowchart. The actual instructions are written inside boxes of Afferent shapes indicating different functions. Solid lines with arrows Indicating the flow of programs are then Definition of sed to connect the boxes. The different symbols which are used for a flowchart Include: Flowchart ‘The Terminal denotes the START, STOP or HALT In the program logic flow. It is the first and the last symbol In a program. Halt can be used when there Is an error condition In the program, ‘Any Input or output operation from an input/output device fs shown b ay y this symbol. The input can be from the keyboard, disk, tape, mouse etc. while output can be to the ‘monitor, printer etc. Shapes used ith This symbol is used to represent arithmetic and data movement operations. All Flowchart arithmetic processes (add, subtract, multiply, divide etc.) and logical process the data from one location to another are denoted by this ‘ymbol a 215 P4756 Part 4: Chapter 7 decision Is to be made and ‘This symbol is used at a point where & bia S> jecessar yon. The criteria for the decision sho ! i oe un the to follow should also be mentioned.” iene Inside the box and the num! function In a floweh; [Fanetony]] Ths symbol is used to Indicate any predefined ane u DD rae ee Uesned by a separate flowchart of an algorithm Or can be ayy 1 function. "Y st flowchart becomes This is the symbol of a.Connector, Whenedt @ ; too dificult to fit within a glven page, It can be broken down into parts and po an Joined by Connectors to maintain continuity. This symbol thus signifies an oath a an exit from one part of the flowchart to another. ams B 1s are used to indicate the flow of data or an ope —_ t Flow-lines with arrowheac 5 detefmines the exact sequence in which the program flows. % ‘The advantages in using a flowchart for planning a program are stated below: ages of | a. Since flowcharts are not based on a particular programming language, once a logical solution o roharts Problem has been charted it can be implemented in any programming language, 7 b. Being pictorial in nature, flowcharts are easy to understand, ¢. Large programs can be broken down into smaller modules and different individuals entrusteg working out a particular module. A main flowchart showing the interconnectivity of the dite modules will help to put together the final program. 4d. Error or bug in a program can be easily detected from a graphical flowchart. In spite of these apparent advantages in using flowcharts, there are some obvious disadvantages in uy flowcharts. Some of them are stated below: e ‘@. Being pictorial in nature, flowcharts are time consuming to draw. When writing small programs, may be easier to draw flowcharts but for large programs it may becomes very inconvenient. ntages # In case any change needs to be Incorporate, it is not easy to do the same in an existing flowchartha the flowchart needs to be redrawn and this is a time consuming process, ee Exam ‘Add two numbers. Example-14: Get the absolute value of any number. wa (Use of branching operation with a decision box) ales of charts PA-7-6 216 “Aigoritni ain +r example-13: Print the series 2,3,4, 516 {Use of loop operation, using? ‘decision box) eG» a iemme)) es example-15: Print the factors of a given number. check if profit oF loss 5 made. example 14: buying/selling items. during To overcome the disadv Imitation and disadvantages of a flowchart code mear the technique of dcommor ns the Instructlor pseudo code car Language in a structural form Ee a woeuto or fle ia Sa computer Instructions. weten in Since a pseudo tls somet code Is similar to a com tpoaetties called Progra puter program In structure but Dae riod besicn tandiows written In a common ordi program code. }. The pseudo code Is thus inary language : a step In between the &— When an algorithms is written in a structural form Pseudocode a 217 P4-7-7 Quential togic a ditional logic a ative logic Part 4: Chapter 7 ‘The basic Jogi have bee ic structures that are used to write a pseudo code and that have been found to be "ing almost all computer programs are: Sic 1. Sequential logic 2. Conditional logic 3. Iterative logic Sequential logic: 1 Tinear manner without ar : Implies the flow of program is in a linear out any branching, with instructions wetter down stepwise. ARer carrying out an instruction the ont Clown stepwise ere Is no branching in between and Program control passes on to the next line of code. There ") the program proceeds in a sequential manner, The figure on the right shows the flowchart Sy PROCESS) for sequential logic. The following finds out the product of the Program pseudocode Inputs two numbers, Numbers and then prints the result. Input two numbers a & b Calculate result a*b Print result Stop Conditional logic: This logic structure Is used to perform a set of Instructions based on one or more conditions. Depending upon the condition one or more decisions can be taken and the Program logic branches to different paths. The If-Then-Else Structure or If-Else structure is used to depict such a situation. If a certain condition Is satisfied then the program carries out a set of instructions else another set of instructions are carried out. The figure on the right shows the flowchart for conditional logic. The following example shows the pseudocode of a program that inputs two numbers and determines which is the larger one, (The line numbers are given to help in understanding the logic and may not be used in an actual pseudocode). Input two numbers: a, b = 4 2 ia>b then 3 Print “a is greater than b” 4 Else 5 ifb>a then 6 Print ‘b Is greater than a” 7 Else 8 Print “a fs equal tob” 9 Endit 40 End if 11 Stop Note the use of indentations to indicate a subsection of the code. Line Is a subsection which is under the /f statement of Line2. Hence Line3 Is Indented to the right with respect to Line2. Similarly, Line5 is indented to the right with respect to Lined as it Is a Subsection of the else statement of Lined. In this manner, by using indentations, each logical block Is Identified. fe logic: When one or more Instructions need to be reroited several times based on certaln conditions then we get “The Instruction block that needs to be repeated Is put logic. tert Body of the Toop and the looping continues as long asa sigin condition Is satisfied. The While, Repeat-Until, and For- Next structures are usually used to Indicate a loop In a pseudocode. PROCESS 2 Next sroral structure of an erative loop 1s shown by the flowchart on the right. [ P4-7-8 Rudiments of Computer Solence ‘Algorithm and Flowchart inthe following example the pseudocode Is used to calculate the factorfal of an Input number. Input the number: nuim Define: factorial <—1 Initialise loop counter: |< 1 White i= num, foop factorial factorial */ feet End loop Print the value of factorial ‘Stop ‘The advantages of using 2 pseudocode are: 1 Itis easier to convert a pseudocode to a Pp 2. Itis a lot easier to modify a pseudocode than a flowchart, features needs to be incorporated. 4. ‘Since pseudocode generation does not involve any graphics, pseudocode than to draw a flowchart. In spite of the above advantages there are certain disadi 1. Graphic representation is much easier to interpr 2. Pseudocode generation does not involve any standard rules and hence different p1 have their own style of writing a pseudocode resulting in a lack of uniformity. gramming language code than from a flowchart. in case some change in logic or additional itis much less time consuming to write a vantages which include: yret but pseudocode does not have any such scope. rogrammers: Examplet6: Let us now write down the pseudocode to reverse the digits of a number. Define variables: num, rev_num <0 Input: num While num #0 rev_num e rev_num*10 + num(MOD)10 num <— INT(num/10) End loop Print rev_num Stop Examplei7: Write the pseudocode to find the real and imaginary roots of a quadratic equation. Jn dealing with this problem as we have discussed earlier, we have to take as In i put the coefficients of the different terms of the quadratic equation of the form ax’-+bx+c=0. Then we have to check whether the discriminant D=b?-4ac is equal to zero, positive or negative. Based on the sign of D, the roots will be real or Iraghary. We have to check If a=0, In tht case the equation will not be a quadratic one and will have to ask 2 fresh input. The pseudocode for the above problem is: ‘Input the coefficients: a, b, ¢ while a0 deb 4atc Wd=0 root! «-b/(2"a), root2 - ~bi{2"a) Print roott, root2 Wa>0 root « ~b/(2%a)-(vdy(2"a), root2 « ~b/(2"a}+(va)/(2"a) Print root, root? Wa> | Partt: Chapter 7 Eeampleza: write down the pseudocode to read 10 real numbers and find thelr average, Define an array to hold 10 real numbers: Arr(10) Pefine variables: i+ 4, sume 0, average 1<210 Input Arr(y) ar End loop fot While <= 10 sum & sum +Arri) dent End loop average < sum/10 Print average Stop Example19: Write the pseudocode to reverse the order of the numbers in an array of numbers, Define variables: }<1,temp, n Define an array to hold n real numbers: Arr(n) ‘Input the number of elements in the array: While i <=n Input Arc) ie et End loop teat While | <=n/2 temp Arri) Arr()< Arr(n-i+1) Arr(n-i+ 1) <— temp jew End loop yet While i<=n Print Arc() set End loop Stop Example20: Write the pseudocode to check whether a string is a palindrome or not. Define varlables: 1<-1, temp, fen 0 Define two string varlables: String, String? Input string to check: String? ‘String2 = String? Repeat MStringt() <> End of String fone lont4:/< 1+4 Until End of String fet White <= Ion String2(len -1+ 1) « String (/) jet End loop Wf String? = String? then Print “The string /s a palindrome” Ese Print “The string Is not a palindrome” Stop P1-7-10 220 rudiments of Computer Science ‘Algorithm and Flowchart _ agra Daehn Pasa used work OV whe pug done a2 te rien ad . TFBS hon the problem statement the cfferent Inputs, output, rulee etc, thet must be a nese dea ‘of the jing. Since the be. ‘thar porated her hie part. he ering Scat cn be moe an re wy + Re nora Daa Tay aay en a te bes sfaon epee pte a han teat cag of he program Lt the proceso sang he roar Coleg Pass ns sep yeep mer enna prt prooemming ange, TPs ang ha pea in cv ews Sa '3 good program, even If Invalid Inputs are supplied the program should be able to detect them. nos Fr tn Phase i equa to make program code Pep ron Toe an rset at coats pls mit ie yo ue of arte nyt ; structions oa eet reat and ramoiguusnscucons designed in such 2 way thet f te + gi tied sage be dese re aed with ln mbt Ss ‘Sometimes by increasing ‘the amount of space used for storing the data, the time required for . Ing the data may get reduced. On the other hand reducig the space for storing the data can procesing ge In tne time required to process the data. This __ eestoan eco ered oil ones wth spec smb to ndeate te ASST Sp ie 30 25a ada flower. The aca ns, ae wean resets er ucons: So es with ars indating the ow of progres boxes. |. poondo means Imitation and code means the Instructions for the progrtt ‘The pseudo or false PreodGuons are written In @ common language In a structural form that resembles computer Instructions QL. Multiple Choice Questions. Select any one from the four options. Leach 1) Analgorithm: a. May or may not produce the exact solution to a problem b. Should get the result within a finite time limit. ¢ May take any amount of time to process the data dd. May not follow a definite sequence of steps J) When an algorithm is expressed ina pictorial manner with special symbols to indicate the different types of instructions, then itis called a: a. logic chart b. design chart c. flowchart d. algo chart Ji) What type of an operation is denoted by the Terminal symbol in a flowchart? a. START b. STOP HALT 4. All of these iv) What type of an operation is denoted by the Parallelogram symbol in a flowchart? 2. calelation b. input or output ——_c. decision 4. process ¥) What type of an operation is denoted by the Rectangle symbol in a flowchart? ‘a. input or output b, terminal c. process 4d. decision ¥) What type of an operation Is denoted by the Rhombus symbol in a flowchart? a. terminal b. decision cc. input or output ——d. process @. Short Answer type questions: 1) What s an algorithm? i) Write the algorithm to increment a variable num by 1, lil) What is a flowchart? N) Draw the flow chart to decrease the value of a variable num by 1. ¥) State one advantage of using a flowchart. n State one disadvantage of using a flowchart ° ‘What Is the use of the Parallelogram symbol in a flowchart? What Is the use of the Rectangle symbol in a flowchart? Leach 2a PA-7-44 Part 4: Chapter 7 What is the use of the Rhombus symbol in a flowchart? ix) x) What do you mean by a pseudocode? xi) State one difference between a pseudocode and an algorithm. xii) State one advantage of using pseudocode. xiil) State one disadvantage of using pseudocode. xiv) Write the pseudocode to increment a variable y by 1? xv) Name any one of the basic logic structures that is used to write a pseudo code, Q3. Long Answer type questions: 7 each ') Write the algorithm to input the length and breadth of a rectangle and calculate and display i area and perimeter. Explain any two phases of program development. ~ 3424 il) Write the algorithm to input the number of terms for the following series and print the terms ote series up to that number: 5 1, 5, 25, 125, sue State any two advantages of using a flowchart. 2 lil) Write the algorithm to input three numbers and print the larger of the three numbers, 5 Explain the terms ‘sequential logic’ and ‘iterative logic’, 2 lv) _ Draw the flowchart to Input two numbers x and y and print the result x’ without using any power or exponent operator (hint: use iterative logic]. 5 Explain the terms ‘conditional logic’ and ‘pseudocode’. 2 v) What Is a flowchart? Draw the flowchart to find the sum of the numbers which are divisible by 7in 25 a set of N numbers input by the user.

You might also like