Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A robot is used to transfer apples from a container to a production line and the

ID: 1766687 • Letter: A

Question

A robot is used to transfer apples from a container to a production line and the robot can pick up no nore than 9 apples at one time. If the robot picks up 2 apples every time, then after certain number of times, only 1 apple is left in the container. Likewise, If the robot picks up 3 apples every time, then at the end only 0 apple left, If the robot picks up 4 apples every time, then at the end only 1 apple left, If the robot picks up 5 apples every time, then at the end only 1 apple left, If the robot picks up 6 apples every time, then at the end only 3 apple left, If the robot picks up 7 apples every time, then at the end only 0 apple left, If the robot picks up 8 apples every time, then at the end only 1 apple left, If the robot picks up 9 apples every time, then at the end only 0 apple left. Program in matlab to answer the following question: what's the minimum possible number of apples in the container?

Explanation / Answer

%Program to calculate minimum no of apples
clc;clear;
for i=1:1000
if (mod(i,2)==1)
if(mod(i,3)==0)
if(mod(i,4)==1)
if(mod(i,5)==1)
if(mod(i,6)==3)
if(mod(i,7)==0)
if(mod(i,8)==1)
if(mod(i,9)==0)

g=i;
end
end
end
end
end
end
end
end
end

fprintf('The minimum number of apples are %d',g)  

% Hope You Enjoyed The Answer.For queries Comment below

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote