AF
1. Feel Free to ask and submit anything on Anyforum.in and get satisfactory answer
3. Our Experts are looking for yours ?.

# corejava-programming: Cozy number

 Find the given number N is cozy number or not. Input Constrains: 1<=N<=30000 Note: If input is not according to the constrains then output should be InputValueOutOfBoundryException Input 1: 6 output 1: 6 is a cozy number. Input 2: 210 output 2: 210 is not a cozy number. Input: -1 output: InputValueOutOfBoundryException Explanation: The proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110. Summation of all the divisor of 220 is 284. The proper divisors of 284 are 1, 2, 4, 71 and 142; Now Summation of all the divisor of 284 is 220 therefore 220 is cozy number. corejava x 353programming x 169 Posted On : 2016-10-21 00:20:17.0 Aarti Kumar 5900 5

 import java.util.Scanner; public class CozyNumber { public static void main(String[] args) { Scanner input=new Scanner(System.in); int number=input.nextInt(); if(number>=1 && number<=30000){ System.out.print(number); System.out.print(number==getSumDivisors(getSumDivisors(number)) || number==1?" is a ":" is not a "); System.out.print("cozy number"); }else{ System.out.println("InputValueOutOfBoundryException"); } } public static int getSumDivisors(int num){ int sum=0; for(int i=1;i