Professional Documents
Culture Documents
29SCS124
Ex. No: 6a
02/02/2011 Armstrong Series
Aim:
To print the Armstrong series.
Algorithm:
1. Start
2. Enter the limit as n.
3. Initialize
a. For I = 1 to n
b. {
c. a=i
d. b=i
e. c=i
f. sum=0
g. d=0
4. while b is greater than 0 perform
a. s = int of (b%10)
b. d = d+1
c. b = int of (b/10)
5. while a is greater than o perform
a. r = int of (a%10)
b. sum = sum + (r raised to d)
c. a = int of (a/10)
6. if sum is equal to c then print sum thus printing the armstrong series
7. Stop
Priyankar Paul 2
29SCS124
Program:
Output:
Result:
Thus the PERL program to print the Armstrong series was successfully executed and its
output was verified.