Q:

Write a function that will receive an integer n and a character as input arguments, and will print the character n times

0

Write a function that will receive an integer n and a character as input arguments, and will print the character n times.

All Answers

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

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

total answers (1)

Similar questions


need a help?


find thousands of online teachers now