Loop Question with divison
Mostra commenti meno recenti
I have the number 0.357. I want to multiply the number by 2 until it gets to a whole number. Once it gets to a whole number I want to subtract the whole number from 1 and then multiply by 2 until it becomes a whole number again. And I would like this to happen a specific number of times also.
- This what I am trying to get my code to do. (Below)
0.357 *2 = 0.714
0.714 * 2 = 1.428
0.428 * 2 = 0.856
0.856 * 2 = 1.712
0.712 * 2 = 1.424
Thanks
2 Commenti
James Tursa
il 20 Feb 2016
What have you done so far? Do you know how to program a for loop? Do you know how to program an infinite while loop?
WhatIsMatlab-
il 20 Feb 2016
Modificato: WhatIsMatlab-
il 20 Feb 2016
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!