the product of three consecutive integers is 1716. find that integer using matlab functions. in matlab

We can solve the problem by using loops and conditionals in Matlab. We start by creating a loop that goes through all possible combinations of three consecutive integers. Then, we add a conditional statement that checks if the product is equal to 1716. If it is, we output the integers. Here's the code:

main.m
for i = 1:100
    if ((i*(i+1)*(i+2)) == 1716)
        fprintf("The integers are: %d, %d, %d\n", i, i+1, i+2);
    end
end
123 chars
6 lines

Output:

main.m
The integers are: 12, 13, 14
29 chars
2 lines

Therefore, the three consecutive integers whose product is 1716 are 12, 13 and 14.

gistlibby LogSnag