/*

RULE 1:  Write a new function out of any other function

RULE 2:  You use a function by "calling" it

RULE 3:  If a function is called from a static fn. The called fn, should also be statis

RULE 4 : If a fn does not return anything, return type has to be `void`

*/


import java.lang.*;
import java.util.*;

public class Main {
    
    static int sum_of_two_numbers(int a , int b){  //input parameters  //fun defination
        int sum = a+b;
        return sum ;
    }
        
    public static void main(String[] args) {
        System.out.print(sum_of_two_numbers(10,20));  // function calling 
        
        //========================================================
        
        /* 
        USER INPUT 
        
        Scanner sc = new Scanner(System.in);
        
        int x = sc.nextInt();
        int y = sc.nextInt();
        
        System.out.println(sum_of_two_numbers(x,y)); 
        
        */
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        

    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: