Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
29
Task/Arithmetic-Integer/V-(Vlang)/arithmetic-integer.v
Normal file
29
Task/Arithmetic-Integer/V-(Vlang)/arithmetic-integer.v
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// Arithmetic-integer in V (Vlang)
|
||||
// Tectonics: v run arithmetic-integer.v
|
||||
module main
|
||||
import math
|
||||
import os
|
||||
|
||||
// starts here
|
||||
pub fn main() {
|
||||
mut a := 0
|
||||
mut b := 0
|
||||
|
||||
// get numbers from console
|
||||
print("Enter two integer numbers, separated by a space: ")
|
||||
text := os.get_raw_line()
|
||||
values := text.split(' ')
|
||||
a = values[0].int()
|
||||
b = values[1].int()
|
||||
|
||||
// 4 basics, remainder, no exponentiation operator
|
||||
println("values: a $a, b $b")
|
||||
println("sum: a + b = ${a + b}")
|
||||
println("difference: a - b = ${a - b}")
|
||||
println("product: a * b = ${a * b}")
|
||||
println("integer quotient: a / b = ${a / b}, truncation")
|
||||
println("remainder: a % b = ${a % b}, sign follows dividend")
|
||||
|
||||
println("no exponentiation operator")
|
||||
println(" math.pow: pow(a,b) = ${math.pow(a,b)}")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue