How to write a matlab code for this question?
4 visualizaciones (últimos 30 días)
In a forest, there were 'x' bunnies, 50% male, and 50% female, all adults. Bunnies doubles every 15 days, 10% of the baby rabbits dies at birth. They mature after 30 days, 30% leave the forest, and rest becomes rabbits. In every 30 days , 25% dies off due to flu. If every bunny dies off, the bunny world ends.
Calculate the final number of bunnies alive after 1 year for any number of initial bunnies, x.
Will be an integer number, the number of initial bunnies. Your program should read from the standard input
Your program should write back to the standard output. When all bunnies die off, write 0 to the standard output.
Test Case 1
Test Case 2
Hint - the information about 50% male, 50% female doesn't matter. There are no separate birth and death rules mentioned for males and females.
The general structure of the solution would probably be a for loop like this
%do 15 day birth/death update
%do 30 day birth/death update