Computer Science, asked by Yusuf75761, 8 hours ago

The program accepts an integer N and prints the value of N+1 if N is less than 10 and prints value N-1

Answers

Answered by allysia
3

Language:

Python

Program:

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

if n<10:

   print(n+1)

else:

   print(n-1)

Input/Ouput:

Enter a number: 5

6

Enter a number: 45

44

Explanation:

  • n accepts a number
  • using else-if statements we get the desired output.
Similar questions