How do I write a for loop for multiple situations?

1 次查看(过去 30 天)
in the attached document, how do i write loops to determine if theres a pair or five-of-a-kind. Would i set up a vector, and make an element in each vector equal to something? Would really appreciate your help, I can attach my script file for rolling two dice if that would help. I really do appreciate the help you guys have to offer.

采纳的回答

Joseph Cheng
Joseph Cheng 2015-9-30
You do not need loops to determine the N-of a kind. If you follow the assignment you should be looking at the sorted array and how many same numbers are adjacent see documentation on diff(). If you can be creative and go away from the method in the assignment look at the function mode()

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by