Azzera filtri
Azzera filtri

rand but even numbers

3 visualizzazioni (ultimi 30 giorni)
stephen aboasu
stephen aboasu il 12 Set 2015
Risposto: Star Strider il 12 Set 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.

Risposte (1)

Star Strider
Star Strider il 12 Set 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.

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by