Search
 
SCRIPT & CODE EXAMPLE
 

RUST

Take two integers, return the quotient and remainder, divmod

//  Take two integers, return the quotient and remainder
fn divmod(dividend: isize, divisor: isize) -> (isize, isize) {
    (dividend / divisor, dividend % divisor)
}

fn main() {
    let (q, r) = divmod(14, 3);
    println!("divmod = quotient {}, remainder {} ", q, r);
}
Comment

PREVIOUS NEXT
Code Example
Rust :: armanriazi•rust•orphan•rule 
Rust :: armanriazi•rust•static 
Rust :: how to create an integer in rust 
Rust :: armanriazi•rust•rc•vs•arc 
Rust :: armanriazi•rust•type•wrapper•vs•clone 
Rust :: declare an array with signle value Rust 
Rust :: loop label in rust 
Rust :: rust lang unresolved import 
Rust :: armanriazi•rust•code•string•to•u128 
Rust :: rust init vector with range 
Rust :: armanriazi•rust•trait•object•safe 
Rust :: reverse a string with runes 
Rust :: rust random float between 0 and 1 
Lua :: lua 
Lua :: luau make region 
Lua :: lua integer to string 
Lua :: my second long scripting 
Lua :: input in lua 
Lua :: lua what is _ENV 
Lua :: roblox random number generator 
Lua :: get last characters of string lua 
Lua :: lua comments 
Lua :: lua split 
Lua :: what is lua programming language 
Lua :: wails compile 
Matlab :: matlab title figure 
Matlab :: matlab plotting multiple lines on one graph 
Matlab :: how to multiply matrixes in matlab 
Basic :: dos assign command output to variable (when output is a single line) 
Elixir :: elixir write base64 to file 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =