The output value is 100000 to 10 random natural numbers
What should I do to print out only from the right end to the third?
And if you print it out with multiple of ten, an error appears
so, if we get a multiple of 10, i want to put out 010 something
for example, input -> 6545 output -> 545,
input -> 27 output -> 027
and i’m using java.
pls help me
>Solution :
Assuming your inputs are actually ints:
System.out.printf("%03d",inputvalue%1000);
should give the result you want:
"%03d"forces output with zero paddinginputvalue%1000calculates the remainder of division by 1000 (modulo), which will chop off all digits to the left of the three last