+ 1
Print Even Number in Java
How To write a Program using for loop to print Even Numbers from 1 to 25.
8 Respostas
+ 9
IN JAVA: -đđđ
public class Program
{
public static void main(String[] args) {
for (int i = 1; i <= 25; i++) {
if (i % 2 == 1) {
System.out.println(i);
}
}
}
}
hope u got the answer đ€đ€
+ 10
IN JAVA: -đđđ
public class Program
{
public static void main(String[] args) {
for (int i = 1; i <= 25; i++) {
if (i % 2 == 0) {
System.out.println(i);
}
}
}
}
hope u got the answer đ€đ€
+ 8
IN PYTHON: -đđđ
for i in range (1, 25):
if i%2==0:
print(i)
------------------------------------------------------------------
IN C: -đđđ
#include <stdio.h>
int main() {
int i=1;
for(i;i<=25;i++){
if (i%2==0){
printf("%d\n",i);
}
}
return 0;
}
+ 2
in python with lambda:
print(list(filter(lambda x: x % 2 == 0, range(1,26))))
+ 2
In Java.
+ 2
Yupp.
+ 1
Similar Program to Print Odd Numbers.
+ 1
Thankyou so much đ.