Write a function that will receive an integer n and a character as input arguments, and will print the character n times
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:6| Question number:8.6
All Answers
total answers (1)
printNChars.m
function printNChars(n, ch)
% Receives n and a character and prints
% the character n times
% Format of call: printNChars(n, character)
% Does not return any values
for i = 1:n
fprintf('%c', ch)
end
fprintf('\n')
end
need an explanation for this answer? contact us directly to get an explanation for this answer