what will happen if our function requires atleast one parameter and returns nothing execept some string of characters | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

what will happen if our function requires atleast one parameter and returns nothing execept some string of characters

i want to get an input from user and tell the user whether the numbr is even or odd.. i can do it by simply using if else conditional statement.. but i want to know can we do it by using functions? yes then how? as our function requires atleast one input(number) from user and returns a character string (even or odd)..

5th Oct 2019, 8:11 PM
Muhammad Usman
Muhammad Usman - avatar
4 Answers
+ 1
Please first try to write code. If you are facing any problem then share with your question.
5th Oct 2019, 8:47 PM
A͢J
A͢J - avatar
+ 1
Define a function of type string that takes an int as a parameter and returns "odd" or "even" using a simple if else statement.
5th Oct 2019, 9:54 PM
rodwynnejones
rodwynnejones - avatar
0
i've tried but it says traped .. after getting the input from user ..
5th Oct 2019, 8:56 PM
Muhammad Usman
Muhammad Usman - avatar
0
Sure next time I'll..
5th Oct 2019, 9:01 PM
Muhammad Usman
Muhammad Usman - avatar