Computers and Technology, 25.09.2019 13:50 brittanyelliott028
Im trying to figure out how to write a program that finds prime factors of a number. i have the following but it only works for the number 12 for some reason. % this program will determine if an integer is prime and determine
% its prime factors function main clear; clc; % define number(s) to be checked, call function, and print output
n = 12; [answer, primefactors] = primey(n); fprintf('is %i a prime? %s \n', n, answer) fprintf('the primefactors of %i are: \n' , n) fprintf('%i \n' , primefactors) n = 12; [answer, primefactors] = primey(n); fprintf('is %i a prime? %s \n', n, answer) fprintf('the primefactors of %i are: \n' , n) fprintf('%i \n' , primefactors) end % end of function main function [answer, primefactors] = primey(n); if mod(n,1)==0 & n/n==1 answer= 'yes'; else answer= 'no'; end for k= 2: n-1 if mod(n, k)==0 factors(k)=k; end [a, b]= find(factors> 0); b primefactors= [1: numel(b)-1] numel(b) for j= 1: numel(b)-1 if mod(b(j),j)==0 primefactors(j)=b(j) end end end end
Answers: 1
Computers and Technology, 23.06.2019 03:30
Many everyday occurrences can be represented as a binary bit. for example, a door is open or closed, the stove is on or off, and the fog is asleep or awake. could relationships be represented as a binary value? give example.
Answers: 1
Computers and Technology, 23.06.2019 22:30
How many points do i need before i can send a chat
Answers: 1
Computers and Technology, 24.06.2019 08:30
Aconsumer would pay an extra they used the rent to own program to buy the computer, rather than using cash. for all of the items, is the cheapest option over the life of the contract. the most expensive overall option is to use purchase the item.
Answers: 2
Computers and Technology, 24.06.2019 09:10
to change the number of rows and columns displayed by the excel object a. select the object and drag a size handle on the active object. b. deselect the object and drag a size handle of the object. c. deselect the object and drag a row or column divider of the object. d. select the object and drag a row or column divider on the active object.
Answers: 2
Im trying to figure out how to write a program that finds prime factors of a number. i have the foll...
History, 28.01.2021 17:40
Health, 28.01.2021 17:40
Mathematics, 28.01.2021 17:40
Chemistry, 28.01.2021 17:40
Mathematics, 28.01.2021 17:40
Mathematics, 28.01.2021 17:40
Mathematics, 28.01.2021 17:40
Mathematics, 28.01.2021 17:40
History, 28.01.2021 17:40
Advanced Placement (AP), 28.01.2021 17:40
Mathematics, 28.01.2021 17:40
History, 28.01.2021 17:40
Mathematics, 28.01.2021 17:40
History, 28.01.2021 17:40
Mathematics, 28.01.2021 17:40
Mathematics, 28.01.2021 17:40