Make a function called half() that takes an integer argument. The function must print the number it received to the screen, then the program should divide that number by two to make a new number. If the new number is greater than zero the function then calls the function half() passing it the new number as its argument. If the number is zero or less than the function exits
Call the function half() with an argument of 100, the screen output should be
100
50
25
...
...
1
please suggest meh the correct coding for this
I have tried it with for loop, do-while loop, while loop, if statement still em not getting the answer.
Call the function half() with an argument of 100, the screen output should be
100
50
25
...
...
1
please suggest meh the correct coding for this
I have tried it with for loop, do-while loop, while loop, if statement still em not getting the answer.