write a program in Java to print 2,4,6,8,....,100 by using for (), while() and do-while () loops.
Home
/
Computer Science
/
write a program in Java to print 2,4,6,8,....,100 by using for (), while() and do-while () loops.
write a program in Java to print 2,4,6,8,....,100 by using for (), while() and do-while () loops.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Answer:
for(i = 2; i<=100; i+=2)
System.out.println(i);
i=2;
while(i!=100) {
System.ou.println(i);
i+=2;
}
i=2;
do {
System.ou.println(i);
i+=2;
} while(i!=100);
hope it helped you sweety ❤️
public class Even
{
public static void main(String args[])
{
int = i;
for(i=100;i>=2;i=i-2)
System.out.println(i);
}
}
BY
ρяเýลиรђµ