How do i finish the code. I'm not even sure if this is how one would start to run the code
Mostrar comentarios más antiguos
Write a program that generates a vector consisting of random integers between 10 and 10 and as soon as a random positive integer that is equal to the last digit of your university ID (9) is found the program stops and displays ONLY the positive even numbers of the vector.
this is what i have so far
v=randi([-10,10])
2 comentarios
Geoff Hayes
el 12 de Mayo de 2020
JR - I think that you being asked to continually generate a random integer and that you should be "collecting" these random integers into an array until the code finally generates a 9 (the last digit of your ID). So you will need a loop of some kind (for or while). Start with the loop, collecting the random integers and checking to see if the most recent random number is 9. What would the code look like?
JR
el 12 de Mayo de 2020
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements 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!