Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Java Program to find the product of odd integers within the range

+2 votes
asked Feb 20, 2019 by anonymous

1 Answer

0 votes
answered Feb 26, 2019 by anonymous
class A{

    

    public int result(int start, int end) {

        int product = 1 ;

        for(int i = start ; i <= end ; i++){

            if(i%2 != 0) {

                product *= i ;

            }

        }

        return product;

    }

}

public class Main

{

public static void main(String[] args) {

    

    A a = new A();

System.out.println(a.result(1,7));

}

}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...