Write code that will prompt the user for 4 numbers, and store them in a vector. Make sure that you preallocate the vector!
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:5| Question number:9.5
All Answers
total answers (1)
vec = zeros(1,4);
for i = 1:4
vec(i) = input('Enter a number: ');
end
need an explanation for this answer? contact us directly to get an explanation for this answer