

Get more lessons like this at
Learn how to use the math functions in the java library to perform calculations and write complex code that require mathematical calculations. Here we learn about powers and square roots.
source
Get more lessons like this at
Learn how to use the math functions in the java library to perform calculations and write complex code that require mathematical calculations. Here we learn about powers and square roots.
source
# Copyright 2020. 신촌우왕TV수학자.천재작곡가 All rights reserved.
# 루트 2 = 1.41421356237309504880168872420969807856967187537694
# Python Code: 임의의 자연수에 대한 ROOT 값을 구하기
ROOT = 2 # ROOT 2의 값. 3으로 변경하면 ROOT 3의 값이 구해짐.
DIGIT = 50 # 소수점 아래 50자리까지 구하기
s = [0, ROOT, ""]
for i in range(DIGIT+1):
for a in range(10 + ROOT):
u = ((s[0])*10 + a)*a
v = ((s[0])*10 + a+1)*(a+1)
if u <= s[1] and s[1] < v:
s[2] += str(a)
s[0] = ((s[0])*10 + a) + a
s[1] = (s[1] – u) * 100
break
if i==0:
s[2] += "."
# 계산 결과가 s[2]에 들어있음.
print("루트 %d의 소수점 %d자리까지의 값:n%s"%(ROOT, DIGIT, s[2]))
#print("Length: " , len(s[2]))
# =====================================================
# 루트 2의 소수점 50자리까지의 값:
# 1.41421356237309504880168872420969807856967187537694
thank you man helped with my hw 🙂
I understood everything but i want integer …. Everytimes i got double as answer 🙁
if we want only integer as return then what should we do?
Another EXPLAINED VIDEO on MATH FUNCTIONS
https://youtu.be/zrf5k776uHY
Thanks