NEED A JAVA PROGRAM WITHOUT USING SCANNER FOR THE FOLLOWING
 NEED A JAVA PROGRAM WITHOUT USING SCANNER FOR THE FOLLOWING List of programming questions  1) If m and n are integers, then sum(m,n) is the sum of all integers in the interval [m,n), which is 0 if the interval is empty. public static int sum(int m, int n){ /*...*/ }  2) If m and n are integers, then product(m,n) is the product of all integers in the interval [m,n), which is 1 if the interval is empty. public static int product(int m, int n){ /*...*/ }  3) If m and n are integers, countEvens(m,n) is the number of even integers which are greater than m and less than n. public static int countEvens(int m, int n){ /*...*/ }  4) If m is an integer, sumUpTo(m) is the sum of the integers in [0,m). public static int sumUpTo(int m){ /*...*/ }  5) If m is an integer, digits(m) is the number of decimal digits in the shortest decimal expansion of m. For example, digits(493) is 3, digits(0) is 1, and digits(-33) is 2. public static int digits(int m){ /*...*/ } Solution
Solving the first four cases :
/* package whatever; // don\'t place package name! */
import java.util.*;
 import java.lang.*;
 import java.io.*;
/* Name of the class has to be \"Main\" only if the class is public. */
 class Ideone
 {
    public static int sum(int m, int n)
    {
        int sum=0;
        int min=m<n?m:n;
        int max=m>n?m:n;
        for(int i=min;i<max;i++)
        sum+=i;
        if(sum==0)
        sum=1;
        return sum;
    }
    public static int product(int m, int n)
    {
        int product=1;
        int min=m<n?m:n;
        int max=m>n?m:n;
        for(int i=min;i<max;i++)
        product*=i;
       
        return product;
    }
   
    public static int countEven(int m, int n)
    {
        int count=0;
        int min=m<n?m:n;
        int max=m>n?m:n;
        for(int i=min+1;i<max;i++)
        {
            if(i%2==0)
            count++;
        }
       
        return count;
    }
    public static int sumUpTo(int m)
    {
        int sum=0;
       
        for(int i=0;i<m;i++)
        sum+=i;
       
        return sum;
       
    }
    public static void main (String[] args) throws java.lang.Exception
    {
        // Smaple Input.
        System.out.println(sum(4,6));
        System.out.println(product(4,6));
        System.out.println(countEven(3,9));
        System.out.println(sumUpTo(3));
    }
 }


