"import java.util.*;
import java.lang.*;
public class GfG{
// function to find sum of
// first n even numbers
static int evenSum(int n)
{
return (n * (n + 1));
}
public static void main(String argc[])
int n = 20;
System.out.println(""Sum of first "" + n +
"" Even numbers is: "" +
evenSum(n));
"
Copyright © 2024 EHUB.TIPS team's - All rights reserved.
Answers & Comments
"import java.util.*;
import java.lang.*;
public class GfG{
// function to find sum of
// first n even numbers
static int evenSum(int n)
{
return (n * (n + 1));
}
public static void main(String argc[])
{
int n = 20;
System.out.println(""Sum of first "" + n +
"" Even numbers is: "" +
evenSum(n));
}
}
"