Hi every body
How to find smallest number and how many occurrence with the user input numbers until enter 0 ?
this my code .......
package javaapplication101;
import java.util.Scanner;
public class JavaApplication101 {
public static void main(String[] args) {
int num = 0 , min = num ; int count=0;
Scanner input = new Scanner(System.in);
System.out.println("Enter a number : ");
num=input.nextInt();
for(;;){
if(num==0)
break;
if (num < min && num >= 0)
min = num;
System.out.println("Enter a number : ");
num=input.nextInt();
}
System.out.println("The min number is : " + min );
System.out.println("The occurrence count of the min number is : " + count);
}
}