Search
 
SCRIPT & CODE EXAMPLE
 

RUST

rust sum and average of number list

let numbers = [1,3,2,4,5,6,7,8,9];
let sum: i32 = numbers.iter().sum();
let avg = sum as f32 / numbers.len() as f32;
println!("sum {} avg {}", sum, avg);
Comment

PREVIOUS NEXT
Code Example
Rust :: armanriazi•rust•error•E0501•cannot borrow `x` as immutable because previous closure requires unique access 
Rust :: how to check if a thing is in a vector in rust 
Rust :: rust•armanriazi•thread•sync•sharedstate•mutex 
Rust :: armanriazi•rust•concept•jargon 
Rust :: rust tuple vs vec 
Rust :: rust match enum 
Lua :: how to disable animations roblox 
Lua :: get all players roblox 
Lua :: absolute value in lua 
Lua :: how to make a part rotate roblox 
Lua :: lua destroy 
Lua :: roblox tween part color 
Lua :: conda find package version 
Lua :: lua metatable assignment 
Lua :: remove from table lua 
Lua :: lua json decode 
Lua :: how to print a variable in lua 
Lua :: get index of value in table lua 
Lua :: Roblox Luau Wait Alternative 
Lua :: for loop in robox 
Lua :: lua pairs 
Lua :: when do true loop on roblox 
Lua :: how to activate a command if someone wears a accessory in lua roblox 
Matlab :: count even and odd numbers in matlab 
Matlab :: what is java_home 
Basic :: virtualbox 256 vram 
Basic :: shortcut to rename the file on lenovo s340 
Elixir :: liveview component mount 
Scala :: else if scala 
Scala :: scala schema json spark 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =