What is a Divisor?
A divisor is a number that divides another number completely without leaving a remainder.
For example:
Divisors of 10 → 1, 2, 5, 10
Flowchart Logic
The flowchart follows these steps:
- Start the program
- Initialize the number (Num = 100)
- Set divisor value (Div = 2)
- Check if Div is less than Num
- If true:
- Check if Num is divisible by Div
- If yes, print the divisor
- Increase Div by 1
- Repeat the process
- Stop when condition fails
Python Code
num = 100
div = 2
while div < num:
if num % div == 0:
print(div)
div = div + 1
Java Code
public class Divisors {
public static void main(String[] args) {
int num = 100;
int div = 2;
while (div < num) {
if (num % div == 0) {
System.out.println(div);
}
div = div + 1;
}
}
}
JavaScript Code
let num = 100;
let div = 2;
while (div < num) {
if (num % div === 0) {
console.log(div);
}
div = div + 1;
}
Output
2
4
5
10
20
25
50