Record Program 10th
Record Program 10th
System.out.println();
}
}
}
3.Write a program to input a number. Find the sum of digits and the number of digits. Display
the output.
Sample Input: 4539
Sum of digits = 21
Number of digits = 4
ans)import java.util.Scanner;
int sum = 0;
int numberOfDigits = 0;
int tempNumber = number;
4.Write a java program for the given type of number.A number is said to be Duck
if the digit zero is (0) present in it.
Sample Input: 5063
Sample Output: It is a Duck number.
Sample Input: 7453
Sample Output: It i
s not a Duck number.
—------------------------------------------------------------
5.Write a menu driven class to accept a number from the user and check whether it
is a Palindrome or a Perfect number.
(a) Palindrome number: (A number is a Palindrome which when read in reverse
order is same as in the right order)
Example: 11, 101, 151 etc.
(b) Perfect number: (A number is called Perfect if it is equal to the sum of its
factors other than the number itself.)
Example: 6 = 1 + 2 + 3
—------------------------------------------------------------------
6.Write a program to display all the 'Buzz Numbers' between p and q (where p<q).
A 'Buzz Number' is the number which ends with 7 or is divisible by 7.