Computer Science, asked by kavyavaddella2907, 1 month ago

you are given a number find the largest three digit odd number contained with in with the given number
input 6478434
output 843
input 3011213
output 301​

Answers

Answered by subhamsharma996
0

Answer:

Explanation:

843

Answered by priyarksynergy
0

Given below is the program for the required function using Python programming problem.

Explanation:

  • Given problem can be solved by saving the number in a list and running a for loop for every three group of numbers and saving them in another variable 'num1'
  • Then saving this 'num1' in another list 'temp' if 'num1' is odd ( that is using '%' operator if its remainder is 1 ) and returning 'max()' of the list 'temp'.
  • PROGRAM:
  • def FindLar( num ):
  •           temp=[]
  •           for i in range(len(num)-2):
  •                   num1=num[i:(i+3)]
  •                   if (num1%2==1):
  •                          temp.append(num1)
  •           return max(temp)
  • num=list(input("Enter the Number: "))
  • print( "The largest odd number contained within the given number is ", FindLar(num) )

Similar questions