Computer Science, asked by loganihrishi, 1 month ago

write a python program to input a number n and form a number by incrementing each digit by 1. The digit 9 should be replaced with 0.
For example:
If the original number is 129, the new number should be 230.

Answers

Answered by madhalaimuthucharlas
0

Answer:

a = str(input("ENTER: "))

L = []

for i in a:

num = int(i)

num += 1

if num > 9:

num = 0

L.append(num)

else:

L.append(num)

print (int(''.join(str(i) for i in L)))

Answered by anindyaadhikari13
0

Answer:

This is the required program for the question in Python 3.

n=int(input("Enter a number: "))

m=0

for letter in str(n):

x=int(letter)

x+=1

if x==10:

x=0

m=m*10+x

print("Modified Number: ",m)

Algorithm:

  1. START.
  2. Accept the number.
  3. Initialise m=0
  4. Convert the number into string.
  5. Get the letters of the string from first to last.
  6. Convert each letter to number and add 1 to it.
  7. If the result becomes greater than 9, change it's value to 0.
  8. Multiply m by 10 and add the result to it.
  9. Display the value of m at last.
  10. STOP.

See the attachment for output .

Attachments:
Similar questions