Crates.io | mathematics_table |
lib.rs | mathematics_table |
version | 0.1.0 |
source | src |
created_at | 2020-05-11 06:59:39.431841 |
updated_at | 2020-05-11 06:59:39.431841 |
description | A rust library that will generate a math table of an integer given by the user. |
homepage | https://github.com/haseebulhassan-IOT/mathematics_table |
repository | https://github.com/haseebulhassan-IOT/mathematics_table |
max_upload_size | |
id | 240019 |
size | 15,091 |
A rust library that will generate a math table of an integer given by the user.
To use this library in your code, you just need to add following line in the dependencies section of your cargo.toml file
[dependencies]
mathematics_table = "0.1.0"
Your cargo.toml file will look like this:
[package]
name = "mathematics_table"
version = "0.1.0"
authors = ["Haseeb ul Hassan <haseeb.ee12@gmail.com>"]
edition = "2018"
[dependencies]
mathematics_table = "0.1.0"
Now, just come in src/main.rs
to use this library crate.
Write the following lines and it will generate a math table of integer '9', we have taken '9' for example, you can add any integer in place of '9':
use mathematics_table;
fn main () {
mathematics_table::table::integer(9);
}
Another way to use this is as follow:
use mathematics_table::table;
fn main () {
table::integer(9);
}
Now in the end, just use cargo run to get a math table of integer '9'.
Here the mathematics_table
is name of crate, table
is the name of module and integer
is the name of function.
You can pass only integers as an argument in the integer
function.
The output will be like this:
The table of 9 is as follow:
9 X 1 = 9
9 X 2 = 18
9 X 3 = 27
9 X 4 = 36
9 X 5 = 45
9 X 6 = 54
9 X 7 = 63
9 X 8 = 72
9 X 9 = 81
9 X 10 = 90