0% found this document useful (0 votes)
7 views

Function Coding Questions

Uploaded by

Raajveer Mishra
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Function Coding Questions

Uploaded by

Raajveer Mishra
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Function Coding Questions

1. Write a function that inputs a number and prints the multiplication table of that
number
2. Write a program to print twin primes less than 1000. If two consecutive odd
numbers are both prime then they are known as twin primes
3. Write a program to find out the prime factors of a number. Example: prime factors
of 56 - 2, 2, 2, 7
4. Write a function cubesum() that accepts an integer and returns the sum of the
cubes of individual digits of that number. Use this function to make functions
PrintArmstrong() and isArmstrong() to print Armstrong numbers and to find
whether is an Armstrong number.
5. If all digits of a number n are multiplied by each other repeating with the product,
the one digit number obtained at last is called the multiplicative digital root of n.
The number of times digits need to be multiplied to reach one digit is called the
multiplicative persistance of n.
Example: 86 -> 48 -> 32 -> 6 (MDR 6, MPersistence 3)
341 -> 12->2 (MDR 2, MPersistence 2)

6. Write a function sumPdivisors() that finds the sum of proper divisors of a number.
Proper divisors of a number are those numbers by which the number is divisible,
except the number itself. For example proper divisors of 36 are 1, 2, 3, 4, 6, 9, 18

7. A number is called perfect if the sum of proper divisors of that number is equal to
the number. For example 28 is perfect number, since 1+2+4+7+14=28. Write a
program to print all the perfect numbers in a given range

You might also like