to find the divisors of a number and to add all the divisors to check whether it is greater than the given number
The program finds the divisors of a number and checks if their sum is greater than the given number.
Iterate from 1 to the given number
Check if the number is divisible by the current iteration value
If ...read more
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int sum = 0;
System.out.print("Enter the number: ");
int n = scanner.nextInt();
for (int i = 1; i < n; i++) {
if (n % i == 0) {
sum += i;
}
}
if (sum < n) {
System.out.println("The sum of divisors is less than the given number");
} else {
System.out.println("The sum of divisors is greater than the given number");
}
}
}
sum=0
n=input("enter the number")
for i in range(n):
if n%i==0:
sum+=i
if sum print("the sum of divisors is less than the given number") else: print("the sum of divisors is greater than the given numbe...read more
//to find the divisors of a number and to add all the divisors to check whether it is greater than the given number #include
Top Zoho Software Developer interview questions & answers
Popular interview questions of Software Developer
Top HR questions asked in Zoho Software Developer
Reviews
Interviews
Salaries
Users/Month