write a java program to print eveb numbers upto n ( using for loop ) .
Answers
Answered by
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
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
English,
6 months ago
English,
6 months ago
Sociology,
1 year ago
Psychology,
1 year ago
Economy,
1 year ago