1) Develop an algorithm program to add two number.
- Input the two number a and b
- Calculation the sum as a+b
- Store the result in sum
- Display the result
For an Algorithm definition click here…
2) Write an algorithm to calculate the factorial of a given number.
- Read the number n
- [Initialize] i=1,fact=1
- Repeat steps 4 through 6 until i=n
- Print fact
3) Write an algorithm to compute and print the average of a set of data values.
- Set the sum of the data values and the count to zero
- As long as the data values exist, add the next data value to the sum and add 1 to the count
- To compute the average, divide the sum by the count
- display the average
4) Write an algorithm to check palindrome number.
- Read: N
- Initialize R = 0
- Repeat While N ≠ 0
Compute: R = R*10 + R%10
Compute: N = N/10
[ End of Loop ]
- Check: If N == R Then
Print: N is a Palindrome Number.
Print: N is not a Palindrome Number.
[ End of If Else Structure ]
5) Write an algorithm to check armstrong number.
- Take Input N as Integer
- [ initializing SUM ] Set: SUM = 0
- Set: Number = N
- Repeat While Number ≠ 0
SUM = (Number%10)**3 + SUM
Number = Number/10
[ End of While Loop ]
- [ Checking ? ]
If SUM == N then
Print: N is an Armstrong Number.
Print: N is not an Armstrong Number.
[End of If-Else Structure]