Sep 17, 2017 at 6:18 pm

Java Program to show Maximum and Minimum

This Java program prints the maximum and the minimum number of a given numerical digit. For example – typical output would be Please enter a number 42308 and theoutput is –  minimum digit is 0 and the maximum digit is 8   /** Method that shows the minimum and maximum digit *of any given number **/ import java.util.*; public class MaxMin { static void maxMin(int number){ int digit = 0; int min = number; int max = 0; while (number!=0){ digit = number%10; number = number/10; if(max < digit){ max = digit; } if( min > digit) { min = […]

1 2