How to write a script for the following?
Afficher commentaires plus anciens
1 x 8 + 1 = 9
12 x 8 + 2 = 98
123 x 8 + 3 = 987
1234 x 8 + 4 = 9876
12345 x 8 + 5 = 98765
123456 x 8 + 6 = 987654
1234567 x 8 + 7 = 9876543
12345678 x 8 + 8 = 98765432
123456789 x 8 + 9 = 987654321
The script should iterate from 1 to 9 to produce the expressions on the left, then perform the specified operation to get the results on the right, and finally print exactly in the format above
Thank you!
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 4 Nov 2017
0 votes
for loop and use fprintf()
1 commentaire
Zhuoying Lin
le 4 Nov 2017
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!