MATLAB: Error using fprintf function

errorerror in matlab using fprintffprintf

A = 1000000000;
B = A / 512;
fprintf(B);
Error using fprintf
No format character vector.
Error in MachineProblem5 (line 4)
fprintf(B);
can someone please help me with this error, fprinf funtion suddenly goes into error. Same goes with my previous works, it began to display fprintf error

Best Answer

You have to specify a format specifier.
A = 1000000000;
B = A / 512;
fprintf('%f\n',B); % %f is for floating point number, \n is for next line
Related Question