Filter löschen
Filter löschen

rand but even numbers

3 Ansichten (letzte 30 Tage)
stephen aboasu
stephen aboasu am 12 Sep. 2015
Beantwortet: Star Strider am 12 Sep. 2015
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.

Antworten (1)

Star Strider
Star Strider am 12 Sep. 2015
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.

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by