Program for product two numbers using function in java.

import java.util.*;
public class function {
    public static int calculateProduct(int a,int b){
        return a*b;
    }
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        System.out.print("enter two numbers=");
        int a=sc.nextInt();
        int b=sc.nextInt();
        System.out.print("the product of two number is="+calculateProduct(a,b));
    }
}
■》Output->

enter two numbers=>
4
5

the product of two number is= 20

Comments

Popular posts from this blog

Introduction of java Programming language.

Stack data structure.