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일

0 개 추천

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.

카테고리

도움말 센터File Exchange에서 Random Number Generation에 대해 자세히 알아보기

질문:

2015년 9월 12일

답변:

2015년 9월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by