# Function ladderz::pre_algebra::unit1::is_factor

source ·

    pub fn is_factor(x: u32, y: u32) -> bool

Expand description

Checks if a positive integer `x` is a factor of another positive integer `y`.

## Challenge

Write a program that determines whether one positive integer is a factor of another.

## Description

Checks if a positive integer `x` is a factor of another positive integer `y`.

A factor of `y` is a positive integer `x` where `y` is evenly divisible by `x` (i.e., `y % x == 0`).

## Arguments

- `x` - The positive integer to determine whether it is a factor of `y` or not.
- `y` - The positive integer for which the factor check of `x` is performed.

## Returns

`true` if `x` is a factor of `y`, `false` otherwise.

## Examples

    use ladderz::pre_algebra::unit1::is_factor;

    fn main() {
        assert!(is_factor(2, 16)); // 2 is a factor of 16
        assert!(!is_factor(3, 16)); // 3 is not a factor of 16
    }

## Note

This function determines if `x` is a factor of `y` by checking if `y` is evenly divisible by `x` (i.e., `y % x == 0`).