Showing posts with label addition of two number using function in java. Show all posts
Showing posts with label addition of two number using function in java. Show all posts

Sunday, September 22, 2013

, , , ,

Program to illustrate Function with return type and arguments in java


Addition of two numbers.

Code Box
-------------------
/*Program for  function with return type and with arguments*/

class funwithr
{
public static void main(String r[])
{
int total,a,b;
a=Integer.parseInt(r[0]);
b=Integer.parseInt(r[1]);

System.out.print("\nSum of two number:");
total=sum(a,b);
System.out.print(total);    //Function call
}
public static int sum(int a,int b)  //Function Definition
{
int c;
c=a+b;
return c;
}


}

Publisher: Brijmohan Lal Sahu - 3:54 PM
, , , , , , ,

Simple Function in java without return type and without arguments


Code Box

Download Link:
Publisher: Brijmohan Lal Sahu - 3:51 PM