Q:

Experiment, in the Command Window, with using the fprintf function for integers. Make a note of what happens for each. Use fprintf to print the integer 12345

0

Experiment, in the Command Window, with using the fprintf function for integers. Make a note of what happens for each. Use fprintf to print the integer 12345.

 intnum = 12345;

  1.  without specifying any field width
  2.  in a field width of 5
  3.  in a field width of 8
  4.  in a field width of 3

All Answers

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

Answers:

1/

>> fprintf('The number is %d\n', intnum)

The number is 12345

2/

>> fprintf('The number is %5d\n', intnum)

The number is 12345

3/

>> fprintf('The number is %5d\n', intnum)

The number is 12345

4/

>> fprintf('The number is %3d\n', intnum)

The number is 12345

 

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