필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Find divisors by using for loop

조회 수: 1 (최근 30일)
Takashi Fukushima
Takashi Fukushima 2019년 11월 6일
마감: John D'Errico 2019년 11월 6일
Hello,
I have a homework assignment to write a program to find all divisors for a given number by using "for loop", but I even have no idea where to start.
The outcome display looks like this...
Enter a candidate for a prime number: 100 (For example)
Divisor found : 2
Divisor found : 4
Divisor found : 5
Divisor found : 10
Divisor found : 20
Divisor found : 25
Divisor found : 50
The number is not a prime
100 is just an example, and I want this program to find divisors when its user puts a number whatever they want.
I appreciate your response in advance!
  댓글 수: 1
Walter Roberson
Walter Roberson 2019년 11월 6일
Search Mathworks.com for information on requesting user input, and information on for loops.
You also need to think of a way to test whether a number exactly divides another number.

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by