2 Example:Using Pseudo code, Write suitable algorithm:Calculate and print the average temperature, readings for the degrees as the following T1, T2, T3.Input T1, T2, T3avg= (T1 + T2 + T3)/3Print avgInput T1, T2, T3Sum = (T1 + T2 + T3)Avg = sum/3Print avg
3 Flow chart Start or Stop Program Input or Output Process, Calculate, StorageUsed to express logical operations or operations report (Condition)Arrows determine the direction of the program's progressConnection
4 Flow chart start Input : stop Sum = T1+T2+T3 Avg = sum/3 Example : Using flow chart, Write suitable algorithm:Calculate and print the average temperature for the following readings T1, T2, T3.startInputT1, T2, T3Input :T1, T2, T3Processing :Sum = T1+T2+T3Avg = sum/3Output:Sum = T1+T2+T3Avg = sum/3Print avgstop
5 Note: (if X=0 enter value of X again) Using pseudo code and flow chart to write an algorithm. Enter number (X) and then find and print the value (Y), as shown in the following equation:Y=(X-2)/XNote: (if X=0 enter value of X again)Flow ChartstartInput XIf X=0Pseudo codeinput Xprocess if x=0 Re-enter the new value of x because you can not divide by 0 “Y=(X-2)/Xoutput YyesNoY=(X-2)/XPrint Ystop
6 Flow chart Example: start Stop Using flow chart, Write suitable algorithm:Calculate and print the average temperature. Readings as the following T1, T2, T3.IF the average is greater than 15 print the average, else print the weather is cold.startinputT1, T2, T3Sum= T1+T2+T3StartInput T1,T2,T3Sum = T1+T2+T3Avg = sum/3If avg > 15 thenPrint avgElsePrint “cold”End ifendAvg = sum/3NoYesavg > 15Print “cold”Print avgStop
7 DiscussWrite an algorithm using pseudo code and flow chart for the introduction of 3 degrees and find the average temperature and print the "cool air“ if temperature less than 15, Print "moderate air” if temperature between 15 and 25, and print “hot air” if the temperature not verify the previous conditions.
8 Answer : End Yes No Yes Print cool No Print moderate Print hot If avg<15YesNoIf avg<25YesPrint coolNoPrint hotPrint moderateEnd
9 Using pseudo code and flow chart to write an algorithm to calculate the area and perimeter of a rectangle. Note: the area of the rectangle = length × width.Perimeter = 2*(length+width)
10 Using pseudo code and flow chart to write an algorithm to calculate and print the area of a right-angled triangle .The base of the triangle = aThe height of triangle= bEquation of area= (1/2)*a*b
11 Write a program using the pseudo code and flow chart to find the area of a circle which radius R print it. Note: The area of a circle is equal to π * R2, where π is a constant value of approximately 3.14.flow chartstartInput rπ × r × A= rPrint AEndInput RProcessΠ = 3.14A= π × R × RoutputPrint AEndPseudo codeπ = 3.14
12 Using the methods (pseudo code and flow chart), we need to find and print the vicinity of the football stadium, and determine whether international (greater than or equal to 600 m) or local (less so), Note: The perimeter of the rectangle is equal to (length + width) × 2 .flow chartC= 2* (L+W)startInput L,WPrint InternationalEndStartInput L , WC= 2× ( L + W)If c ≥ 600 thenPrint “ international”ElsePrint “ local”End ifprint cEndNoIf C>=600YesPrint Local
13 Formulate resolve the matter to find the zakaah and that if you know money saver and you know that zakaah = × money saver, provided the account of zakaah money if it exceeds 1000 SRFlow chartstartPseudo codeInputmoney mProcessIf m>1000 calculate zakaah else do not calculate zakaahzakaah=0.025*moneyOutputprint zakaahInput MM>1000noyesK=M*0.025Print kstop
14 Formulate a solution to print the odd numbers from 1 to 49 ? Pseudo codeOutput: print output from 1 to 49Input: no inputProcess: transfer from odd number to odd numberno=1Print nono=no+2If no>50 then stop else go to step (2)Flow chartstartNo=1Print NoNo=No+2noNo>50yesstop
15 Write a program that accept an integer from the user and print it is Positive or Negative number.
16 Write a program that accept an integer from the user and test the number . If it is positive print Positive, if it is negative print Negative if equal zero print equal zero.
17 startUse flow chart to write algorithm. Read an integer from the user and test then number . If it is positive print Positive, if it is negative print Negative if equal zero print equal zero.Enter number (n)yesn>0Print “positive”NoyesN<0Print “negative”Noprint “equal zero”end