Take FREE!! Online Cocubes Mock Test to Crack various Companies Written Exams.
Practice List of Paytm Coding Questions !!!
Take 30+ FREE!! Online Arithmetic Aptitude Mock test to crack any Exams.

Program Discussion :: Strings

Home > Programs > Strings

3 / 60

Write a program to print alternate even numbers(2,6,10,14,18....).

Answer:

import java.util.*;

public class AlternateEven 
{
    public static void main(String[] args)
    {    
        Scanner sc=new Scanner(System.in);
        System.out.println("Enter the range: ");
        int n=sc.nextInt();
        System.out.println("Alternate even numbers upto "+n+" are: ");
        for(int i=2;i

Asked In :: Syntel Inc.

Post Your Answer Here:

Language:

Post Your Reply Here: