필터 지우기
필터 지우기

rand but even numbers

조회 수: 3 (최근 30일)
stephen aboasu
stephen aboasu 2015년 9월 12일
답변: Star Strider 2015년 9월 12일
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.

답변 (1개)

Star Strider
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.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by