Computer Science, asked by dixsha, 1 year ago

to print the sum of first 10 even numbers

Answers

Answered by ktr1705
0

Answer:

import java.util.*;

public class Even_series

{

   public static void main (String[]args) {

       Scanner sc = new Scanner (System.in);

       System.out.println("Enter the limit to where the even numbers should be printed :");

       int num = sc.nextInt();

       for (int i = 1; i < num; i++) {

           i = i + 1;

           System.out.print(i + " ");

       }

   }

}

Similar questions