HHW 9
HHW 9
HHW 9
Program 1
A positive integer is called a spy number if the sum and product of its digits are equal. In other
words, a number whose sum and product of all digits are equal is called a spy number.
For ex 1124
Sum=1+1+2+4=8
Product=1*1*2*4=8
Program 2
Write a program that prints the absolute difference between a number and its reverse number.
For ex
Input 493
Output
Number=493
Reverse 394
Absolute difference= 99
Program 3
Write a program that inputs a number and checks whether it is a special two digit number or
not.
A number is said to be a special two digit number if the sum of its digits when added to the
product of the digits, is equal to the original number.
For ex 59
Sum=5+9=14
Product=5x9=45
1
Program 4
Using switch statement, write a menu driven program for the following :
(i) To find and display the sum of the series given below :
𝒙 𝒙 𝒙 𝒙
S= + + +……………………
𝟐 𝟓 𝟖 𝟐𝟎
4 16 36 64….
F=1x2x3x……………………n
Program 5
Program 6
Write a program to input a number and check whetehr it is a perfect square or not.
A number is said to be a perfect number if its square root is an integer.
For ex 36,49