The University of Lahore, CS&IT Department: Programming Fundamentals1 Assignment: Simple Repetition Structures
The University of Lahore, CS&IT Department: Programming Fundamentals1 Assignment: Simple Repetition Structures
Programming Fundamentals1
Instructions:
Students can do assignment in pairs but avoid cross group plagiarism (copying), it will get caught
eventually.
Deadline: December 05, 2018 11:59 PST.
Submission mode: Email the final single .doc report containing all the codes and screen shots of output
as well as the .cpp files of each program in a compressed folder with the clear subject:
“PF1/Ass#2/Section/Rollnumber1/Rollnumber2” at [email protected]. Emails without this
format will not be marked.
11. Write a C++ program to check whether a number is Armstrong number or not.
(An Armstrong number is a n-digit number that is equal to the sum of the nth power of its digits. For
example -
1
6=6 =6
3 3 3
371 = 3 + 7 + 1 = 371)
Example
Input
Input number: 371
Output
371 is armstrong number
12. Write a C++ program to check whether a number is Perfect number or not.
(Perfect number is a positive integer which is equal to the sum of its proper positive divisors.
For example: 6 is the first perfect number
Proper divisors of 6 are 1, 2, 3
Sum of its proper divisors = 1 + 2 + 3 = 6.
Hence 6 is a perfect number.)
Example
Input
Input any number: 6
Output
6 is PERFECT NUMBER
13. Write a C++ program to check whether a number is Strong number or not.
(Strong number is a special number whose sum of factorial of digits is equal to the original number.
For example: 145 is strong number. Since, 1! + 4! + 5! = 145)
Example
Input
Input number: 145
Output
145 is STRONG NUMBER