Crates.io | factorialfunction |
lib.rs | factorialfunction |
version | 0.1.1 |
source | src |
created_at | 2020-05-10 13:12:03.427429 |
updated_at | 2020-05-10 17:10:58.074418 |
description | factorialfunction takes an input of u32 and returns its factorial. |
homepage | https://github.com/shawais786/factorialfunction.git |
repository | https://github.com/shawais786/factorialfunction.git |
max_upload_size | |
id | 239635 |
size | 15,807 |
Function named factorial() takes input of positive integer and shows its factorial If a positive integer is not entered, the function will keep on taking an input until a positive integer is entered. To reduce the size, u32 variables are used hence you can enter from 0 ~ 12 to get factorial. Function will return the factorial of the value entered by you.
To use this library you have to add following line in [dependencies] section of Cargo.toml
factorialfunction = "0.1.0"
Your cargo.toml file should look like this:
.
.
.
edition = "2018"
[dependencies]
factorialfunction = "0.1.0"
In src/main.rs
you can use like this:
use factorialfunction;
fn main() {
println!("Hello, world!");
factorialfunction::factorial();
}
Following will also work:
use factorialfunction::factorial;
fn main() {
println!("Hello, world!");
factorial();
}
now cargo run
for results