write a Java program to display series and sum of series of even numbers till n
Answers
Answered by
1
Answer:
class sum
{
public static void main (String args [])
{
Scanner sc = new Scanner ( System.in);
System.out.println("Enter the value of n");
int sum =0;
int i;
for (i=1;i<=n;i++)
{
if(i%2==0)
sum=sum+i;
}
System.out.println("Sum="+sum);
}
}
#Hope it will help you
Explanation:
Do Subscribe my Youtube Channel
Study To Study ICSE-Swapnil Mehta
Thank you
Similar questions