Q:

Write an input statement that will prompt the user for a real number, and store it in a variable. Then, use the fprintf function to print the value of this variable using 2 decimal places

0

Write an input statement that will prompt the user for a real number, and store it in a variable. Then, use the fprintf function to print the value of this variable using 2 decimal places. 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

>> realnum = input('Enter a real number: ');

Enter a real number: 45.789

>> fprintf('The number is %.2f\n', realnum)

The number is 45.79

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now