rand but even numbers
조회 수: 3 (최근 30일)
이전 댓글 표시
how do I write a script that will generate one random integer between 1 and 100, and will print whether the random integer is an even or an odd number.
댓글 수: 0
답변 (1개)
Star Strider
2015년 9월 12일
Two functions, randi and rem or mod are all you need. Of course you’ll also need one of the print functions such as fprintf or sprintf, but that’s obvious.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!