package com.company;
public class Program39 {
static int sum(int ...arr)
{
int result=0;
for (int a: arr)
{
result+=a;
}
return result;
}
public static void main(String[] args) {
System.out.println(sum(4,5));
System.out.println(sum( 3,4,5));
System.out.println(sum( 4,3,2));
}
}
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 variable argument in function (Java) (202)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment