-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassignment3.7.py
67 lines (58 loc) · 1.46 KB
/
assignment3.7.py
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 8 01:13:54 2019
@author: Shri
"""
def find_max(num1, num2):
max_num=-1
b=[]
if(num1<num2):
for i in range(num1,num2+1):
a=int(i/10)
c=i%10
sum=a+c
if(sum%3 == 0):
count=0
for j in str(i):
count+=1
if(count == 2):
if(i%5 == 0):
b.append(i)
else:
max_num=-1
else:
max_num=-1
else:
max_num=-1
for i in range(len(b)):
for j in range(1+i,len(b)):
print(j)
if(b[i]<b[j]):
b[i],b[j] = b[j],b[i]
if(len(b) == 0):
max_num=-1
else:
max_num=b[0]
else:
max_num=-1
return max_num
#Provide different values for num1 and num2 and test your program.
max_num=find_max(24,34)
print(max_num)
#Sum of the digits of the number is a multiple of 3
#Number has only two digits
#Number is a multiple of 5
#method how to divide two number
#a,b=0,0
#num=34
#a=int(num/10)
#b=num%10
#print(a,b)
#for i in range(10,20):
# b=list(map(int,str(i)))
# sum=0
# for j in str(i):
# for j in b:
# print(j)
# sum=sum+j
# print(sum)