Professional Documents
Culture Documents
Assignment 2
Assignment 2
I. A number is called Armstrong number if the sum of the cube of its digits is
equal to the number itself. Example:
153 = 13 + 53 + 33 then 153 is an Armstrong number.
201 ≠ 23 + 03 + 13 then 201 is not an Armstrong number.
Write a function that takes an integer n then return true if n is an
Armstrong number and false else
II. Write a function that takes an integer n then prints on the screen a
triangle as follows:
If n= 4
The output should be:
1
23
456
7 8 9 10
III. Write a function that takes two integers x and y then return the following
sum:
1 + x + x2/2! + x3/3! + … + xy/y!
IV. write a program that test all the previous functions you did in I,II, and III