Computer Science, asked by ankytakhanal, 9 months ago

write a java program to print eveb numbers upto n ( using for loop ) .​

Answers

Answered by sauravchot56
0

answering

class even

{

int i,n;

public void main()

{

Scanner s= new Scanner (system.in);

System.out.println(Here is even no);

for(i=0,i=<n,i++)

if(i==2)

System.out.println(even no. are :+i);

}

}

Answered by queen276
0

Answer:

import java.util.*;

public class even_numbers

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

int n;

System.out.println("Enter the value of 'n'");

n=sc.nextInt();

System.out.println("The even numbers are:");

for(int i=2; i<=n; i=i+2)

{

System.out.println(i);

}

}

}

Similar questions