15,878,230 members
1.00/5 (1 vote)
See more:
Error is "Int object is not subscriptable.
a = 12 24
and after we need to find lcm and gcd.

What I have tried:

```a = int(input())
for i in range(a):
b = input().split()
c = (a[0])
d = (a[1])
n1, n2 = c, d
while c > 0:
r = c%d
d = c
c = r
gcd = d
lcm = (n1*n2)//gcd
print(gcd)
print(lcm)```
Posted
Updated 22-Jan-22 9:17am
0x01AA 22-Jan-22 13:30pm
You split the input into `b` therefore you should get the values from `b`?
` c = (b[0]) d = (b[1])`

Solution 1

Quote:
a = 12 24

Unfortunately, it is variable b.
Try
Python
```b = input().split()
c = (b[0])
d = (b[1])
```

shri harshan 23-Jan-22 1:05am
I am still getting error
Richard MacCutchan 23-Jan-22 3:25am
Patrice T 23-Jan-22 4:31am
what error ? with what code ?

Top Experts
Last 24hrsThis month
 Pete O'Hanlon 70 Richard Deeming 60 Andre Oosthuizen 55 M Imran Ansari 50 OriginalGriff 20
 Pete O'Hanlon 1,535 OriginalGriff 1,240 Richard Deeming 743 Graeme_Grant 700 Dave Kreskowiak 549

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900