Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

Administrator / lesson11_4

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit bb02eb45 authored a year ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

auto save

parent f12ea14f
Hide whitespace changes
Inline Side-by-side
Showing with 96 additions and 3 deletions
  • 1.py
  • 2.py
  • 3.py
  • 4.py
  • 5.py
  • 6.py
  • 7.py
  • func.py
1.py 0 → 100644
View file @ bb02eb45
n = int(input())
s = str(n*n)
a = str(n)
if (n*n - n)%(10^len(a)) == 0:
print("Y")
else:
print("N")
\ No newline at end of file
This diff is collapsed. Click to expand it.
2.py 0 → 100644
View file @ bb02eb45
n = int(input())
m = n*n
while n != 0:
if n % 10 == m % 10:
n = n // 10
m = m // 10
else:
print("N")
break
if n == 0:
print("Y")
\ No newline at end of file
This diff is collapsed. Click to expand it.
3.py 0 → 100644
View file @ bb02eb45
a = int(input())
b = []
for i in range(1,a+1):
if a%i == 0:
b.append(i)
if len(b)>2:
print("N")
else:
print("Y")
\ No newline at end of file
This diff is collapsed. Click to expand it.
4.py 0 → 100644
View file @ bb02eb45
a = int(input())
for i in range(2,a):
if a%i == 0:
print('N')
break
print('Y')
break
\ No newline at end of file
This diff is collapsed. Click to expand it.
5.py 0 → 100644
View file @ bb02eb45
a = int(input())
b = int(input())
if a < b:
for i in range(a,0,-1):
if a%i == 0 and b%i == 0:
print('gcd(' + str(a) + ',' + str(b) + ')' + '=' + str(i))
break
elif a > b:
for i in range(b,0,-1):
if b%i == 0 and a%i == 0:
print('gcd(' + str(a) + ',' + str(b) + ')' + '=' + str(i))
break
else:
print(a)
\ No newline at end of file
This diff is collapsed. Click to expand it.
6.py 0 → 100644
View file @ bb02eb45
def ex(x,y):
temp = x
x = y
y = temp
def gcd(m,n):
if m>n:
ex(m,n)
for i in range(m,0,-1):
if m%i == 0 and n%i == 0:
return i
a = int(input())
b = int(input())
print("gcd(%d,%d)=%d" %(a,b,gcd(a,b)))
\ No newline at end of file
This diff is collapsed. Click to expand it.
7.py 0 → 100644
View file @ bb02eb45
def ex(x,y):
temp = x
x = y
y = temp
def gbs(m,n):
if m<n:
ex(m,n)
flag = 0
i = m-1
while flag != 1:
i += 1
if i%m == 0 and i%n == 0:
flag = 1
return i
a = int(input())
b = int(input())
print("gbs(%d,%d)=%d" %(a,b,gbs(a,b)))
\ No newline at end of file
This diff is collapsed. Click to expand it.
func.py deleted 100644 → 0
View file @ f12ea14f
\ No newline at end of file
This diff is collapsed. Click to expand it.
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment