rand but even numbers
Mostrar comentarios más antiguos
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.
Respuestas (1)
Star Strider
el 12 de Sept. de 2015
0 votos
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.
Categorías
Más información sobre Random Number Generation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!