Making An Output Display Twice What the Input Was
3 views (last 30 days)
Show older comments
How do you multiply/modify a variable so that the value it displays is twice what the user entered?
I am asking the user to input an age and I want the output to show an age that is two times what the user entered. Can anyone please help?
5 Comments
Answers (1)
Rik
on 17 Sep 2020
You need to make sure you receive the input as a numeric data type, or you need to convert the string input to a double (that is a hint about which function you should be using). Currently you're multiplying the separate characters in the char array, so ['2'*2 '0'*2].
0 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!