Write a program to print the series: 0,2,4,6,8,10 and 12.
Answers
Answered by
1
import java.util.Scanner;
class series
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int sum=0;
for(int i=0;i<=12;i=i+2)
{
sum=sum+i;
}
System.out.println("Sum of the series="+sum);
}
}
Similar questions