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);
}
}
JamesCherrill commented: Duplicate post. OP not listening. -3

Recommended Answers

What are you doing?
This is a duplicate of your post 2 days ago, with exactly the same code mistakes, and completely ignoring the input you got from your previous post.

Jump to Post

All 2 Replies

What are you doing?
This is a duplicate of your post 2 days ago, with exactly the same code mistakes, and completely ignoring the input you got from your previous post.

not to mention the fact that in that other thread, he claims the problem is solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.