1, Develop an algorithm to calculate the sum of 5 numbers.
2, Develop an algorithm to find the largest number among the 3 numbers.
3, Develop an algorithm to calculate the average score of 50 student.
1, Develop an algorithm to calculate the sum of 5 numbers.
Start
Declare Real number1,number2,number3,number4,number5, sum=0
Display "Enter number1,number2,number3,number4,number5: "
Input number1,number2,number3,number4,number5
Set sum=number1+number2+number3+number4+number5
Display "Sum: "+sum
Stop
2, Develop an algorithm to find the largest number among the 3 numbers.
Start
Declare Integer n
Declare Integer i
Declare Integer largest=-111111
For i = 1 To 3
Display "Enter ", i, ": "
Input n
if n> largest
largest=n
end if
End For
Display "The largest number is: ", largest
Stop
3, Develop an algorithm to calculate the average score of 50 student.
Start
Declare Integer score
Declare Integer i
Declare Integer sum
Declare Real average
Set sum=0
For i = 1 To 50
Display "Enter score", i, ": "
Input score
Set sum=sum+score
End For
average =sum/50
Display "The average score of 50 student is: ", average
Stop
Comments
Leave a comment