package com.company;
import java.util.Scanner;
public class Program38 {
static int mysum(int a, int b)
{
int sum;
sum=a+b;
return sum;
}
static int mysum(int a, int b,int c)
{
int sum;
sum=a+b+c;
return sum;
}
public static void main(String[] args) {
Scanner p = new Scanner(System.in);
System.out.println("please enter a first number:");
int x=p.nextInt();
System.out.println("please enter a second number:");
int y=p.nextInt();
System.out.println("please enter a third number:");
int z=p.nextInt();
System.out.print("sum of two number: " );
System.out.println(mysum(x,y));
System.out.print("sum of three numbers: ");
System.out.println(mysum(x,y,z));
}
}
Hi Friends ! You are on HR Developers website. Here you can find the codes of different languages like c ,c++ , java, pyton and many other languages.
Saturday, June 26, 2021
simple program using function overloading (Java) (201)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment