i plan to display all of the odd number, and sum all of the odd number.
please check with my code, there is something wrong...:)

import java.util.Scanner;

public class testing {

    public static void main(String[] args) {
		int sum = 0;

		Scanner scan = new Scanner(System.in);
    	System.out.printf("Enter minimum number: ");
    	int min_Num = scan.nextInt();
    	System.out.printf("Enter maximum number: ");
    	int max_Num = scan.nextInt();

		if(min_Num / 2 != 0)
			for(min_Num <= max_Num)
			{
				System.out.println(min_Num + ", ");
				sum += min_Num;
				min_Num += 2;
			}

    }
}

i done it already, thanks. :)

Be a part of the DaniWeb community

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