×
Reviews 4.9/5 Order Now

Matlab Program to Create Integer Divisibility Function Assignment Solution

June 21, 2024
Dr. Madison Davidson
Dr. Madison
🇺🇸 United States
Programming
Dr. Madison Davidson, an accomplished programming expert, earned her Ph.D. from the University of York, United Kingdom. With 15 years of experience, she excels in solving intricate programming assignments with finesse and expertise.
Key Topics
  • Instructions
    • Objective
  • Requirements and Specifications
Tip of the day
Understand the power of recursion and list manipulation—core concepts in Lisp. Keep your parentheses balanced and use indentation for clarity. Practice writing simple functions first, then build up to more complex expressions. Use the REPL to test and debug your code incrementally.
News
Visual Studio Code v1.101 (May 2025) introduced full Model Context Protocol features, an open-sourced Copilot Chat extension, and expanded Python REPL and agent-mode support—empowering AI-enhanced workflows for student projects

Instructions

Objective

Write a program to create integer divisibility function in matlab.

Requirements and Specifications

Source Code

PROBLEM 1 %% Question 1 % Variable to count the number of integers n = 0; % Variable to store the integers that are divisible by 12 integers_12 = []; % Loop from 1 to 10000 for i = 1:10000 if mod(i, 12) == 0 integers_12(n+1) = i; n = n + 1; end end % Now, get all integers that, when multiplied by the next integer divisble % by 12, the result is divisible by 37 % Create a variable to count integers that meets both conditions nintegers = 0; % Variable to store the largest of these numbers largest_integer = 0; for i = 1:length(integers_12)-1 n1 = integers_12(i); n2 = integers_12(i+1); if mod(n1*n2,37) == 0 nintegers = nintegers + 1; if n1 > largest_integer largest_integer = n1; end end end fprintf("There are %d integers divisible by 12 that when multiplied by the next largest integer is divisible by 37.\n", nintegers) fprintf("The largest of these integers is %d\n", largest_integer); PROBLEM 2 %% Question 1 % Variable to count the number of integers n = 0; % Variable to store the integers that are divisible by 12 integers_12 = []; % Loop from 1 to 10000 for i = 1:10000 if mod(i, 12) == 0 integers_12(n+1) = i; n = n + 1; end end % Now, get all integers that, when multiplied by the next integer divisble % by 12, the result is divisible by 37 % Create a variable to count integers that meets both conditions nintegers = 0; % Variable to store the largest of these numbers largest_integer = 0; for i = 1:length(integers_12)-1 n1 = integers_12(i); n2 = integers_12(i+1); if mod(n1*n2,37) == 0 nintegers = nintegers + 1; if n1 > largest_integer largest_integer = n1; end end end fprintf("There are %d integers divisible by 12 that when multiplied by the next largest integer is divisible by 37.\n", nintegers) fprintf("The largest of these integers is %d\n", largest_integer);

Similar Samples

Explore our samples to see how we tackle diverse programming assignments with precision and expertise. At ProgrammingHomeworkHelp.com, we showcase exemplary solutions that demonstrate our commitment to delivering high-quality code. Whether it's Python, Java, C++, or any other language, our samples reflect our dedication to excellence in programming homework assistance.