Skip to content

Commit

Permalink
Added I/O samples with explanations
Browse files Browse the repository at this point in the history
  • Loading branch information
1Git2Clone committed Nov 23, 2024
1 parent 46c36fd commit 8d3d54b
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/hw2/task_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,37 @@ const MAX: u32 = 2000;
///
/// The count of all the positive numbers up to (and including) `n` which are divisible by `n`.
///
/// ### Sample
///
/// #### Input Format
///
/// ```txt
/// 200
/// ```
///
/// #### Output Format
///
/// ```txt
/// 12
/// ```
///
/// #### Explanation
///
/// The count of the numbers, divisble by n is 12 and they are:
///
/// 1 - 1
/// 2 - 2
/// 3 - 4
/// 4 - 5
/// 5 - 8
/// 6 - 10
/// 7 - 20
/// 8 - 25
/// 9 - 40
/// 10 - 50
/// 11 - 100
/// 12 - 200
///
/// ### Error
///
/// If the input is invalid, return:
Expand Down
19 changes: 19 additions & 0 deletions src/hw2/task_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,25 @@ const MAX: u32 = 2000;
/// The sum of all the positive numbers up to (and including) `n` which are divisible by `n` and
/// also prime numbers.
///
/// ### Sample
///
/// #### Input Format
///
/// ```txt
/// 200
/// ```
///
/// #### Output Format
///
/// ```txt
/// 7
/// ```
///
/// #### Explanation
///
/// 200 = 2^3 * 5^2
/// 2 + 5 = 7
///
/// ### Error
///
/// If the input is invalid, return:
Expand Down
20 changes: 20 additions & 0 deletions src/hw2/task_3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,26 @@ const MAX: u32 = 2000;
/// The sum of all the positive numbers up to (but **excluding**) `n` which are divisible by `n`
/// and are NOT prime numbers.
///
/// ### Sample
///
/// #### Input Format
///
/// ```txt
/// 12
/// ```
///
/// #### Output Format
///
/// ```txt
/// 10
/// ```
///
/// #### Explanation
///
/// The divisors of 12 are 2, 3, 4, and 6
///
/// The sum of the divisors that are not prime is: 4 + 6 = 10.
///
/// ### Error
///
/// If the input is invalid, return:
Expand Down

0 comments on commit 8d3d54b

Please sign in to comment.