Computer Science, asked by aareejshakeel, 4 days ago

write a program inputs even and odd number multiply even num with 5 and odd with 7 and the add both values. the subtract the values from 10000 and display

Answers

Answered by Equestriadash
5

Co‎de:

\tt en\ =\ int(in put("Enter\ an\ even\ number:\ "))

\tt if\ en\%2\ ==\ 0:\\{\ \ \ \ \ }on\ =\ int(in put("Enter\ an\ odd\ number:\ "))\\{\ \ \ \ \ }if\ on\%2\ !=\ 0:\\{\ \ \ \ \ }{\ \ \ \ \ }prod\_en\ =\ en*5\\{\ \ \ \ \ }{\ \ \ \ \ }prod\_on\ =\ on*7\\{\ \ \ \ \ }{\ \ \ \ \ }s\ =\ prod\_en\ +\ prod\_on\\{\ \ \ \ \ }{\ \ \ \ \ }d\ =\ 10000\ -\ s\\{\ \ \ \ \ }{\ \ \ \ \ }print(d)\\{\ \ \ \ \ }else:\\{\ \ \ \ \ }{\ \ \ \ \ }print("The\ number\ isn't\ odd.")\\else:\\{\ \ \ \ \ }print("The\ number\ isn't\ even.")

Explanation:

The numbers were retrieved using the \tt in put() function which is designed for the same, under the int datatype. We then use conditional statements to check if the data/numbers are even or odd. If they satisfy the conditions, the succeeding operations will take place. If they aren't satisfied, appropriate error messages are printed.

Similar questions