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
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:3| Question number:3.5
All Answers
total answers (1)
>> 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