-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexercises.jl
44 lines (36 loc) · 837 Bytes
/
exercises.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# 1
"""Checks if the sum of two sides of a triangle is greater than one side."""
function istriangle(x, y, z)
parse(Int64, x); parse(Int64, y); parse(Int64, z)
if x + y > z || x + z > y || y + z > x
println("No")
else
println("Yes")
end
end
function check()
println("Enter the sides of your triangle a, b, and c:")
print("a: "); a = readline()
print("b: "); b = readline()
print("c: "); c = readline()
parse(Int64, a)
parse(Int64, b)
parse(Int64, c)
istriangle(a, b, c)
end
check()
# 2
"""Adds all the numbers in a list"""
function addall(numbers)
total = 0
parse(Int64, x)
for x in numbers
total += x
end
end
list_of_num = [34, 6, 8, 10]
println(addall(list_of_num))
# 3
"""A function to reverse strings"""
function reversestring()
end