Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • Toggle search form

Frequently Asked Java Program 12: Java Program To Find Divisors Of Given Number

Posted on 03/16/2025 By admin

Hello Folks,

As part of Frequently Asked Java Programs In Interviews For Freshers And Experienced, in this post we will see a Java program to Find Divisors Of Given Number.

Problem:

Write a JAVA program to find the divisors of a given number.

Solution:

  • Divisor is a number that divides  another number without a reminder or a number that divides an integer evenly.

Ex: 10/2= 5 (Here 2 is divisor.)

Logic 1:

  • Positive Divisor of a number N will be greater than or equal to 1 and less than or equal to number N.
  • For Ex: Say Number is 4. Divisor of 4 will be 1,2 and 4.
  • To get the divisor of a number N, we should divide N by all numbers in between 1 and N including 1 and N.
  • We will use modulus operator which gives reminder. If reminder is zero, we can say given number is divisible by another number.
  • For ex: 10%2= 0 (10 is divisible by 2 without a reminder)
  • 11%2=1 (11 is divisible by 2 with a reminder as 1)

Java Code:

Output:

Uncategorized

Post navigation

Previous Post: Java Interview Question 4 – What is HashCode of an Empty String?
Next Post: Protractor Tutorial 3 – Prerequisites To Learn Protractor

Related Posts

window – Make Selenium Easy Uncategorized
git revert Uncategorized
UnevenWhitespaces – Make Selenium Easy Uncategorized
How To Locate Web Element Which Has Multiple Class Names Uncategorized
REST Assured Tutorial 29 – How to create POJO classes of a JSON Object Payload Uncategorized
Guidelines To Clear ISTQB Foundation Level Examination Uncategorized

Recent Posts

  • Getting Started with Selenium 4: What Is New and How to Upgrade from Selenium 3
  • Manual Testing
  • Baby Steps To Become Efficient Selenium-Java Automation Tester
  • Features of Selenium 4.0.0 Release – Java Binding
  • Part 1: Handling Drop-down Created Using SELECT Tag In Selenium

Recent Comments

No comments to show.

Archives

  • April 2026
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • August 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • May 2022
  • March 2022
  • October 2021
  • April 2021
  • March 2021
  • January 2021
  • December 2020
  • October 2020
  • September 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • May 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • January 2018

Categories

  • Getting Started
  • Uncategorized

Copyright © 2026 Make Selenium Easy.

Powered by PressBook Masonry Dark