write programming in java to print odd number between 1 and50
Answers
Answered by
5
Explanation:
class bj
{
public static void main(int n)
{
int n>=1 && n<=50;
if n/2 !=0
System.out.println("the no. is odd")
}
}
arunima0007:
welcome
Answered by
2
Answer:
public class Main {
public static void main(String[] args) {
for(int i=1;i<50;i++)
if(i%2!=0)
System.out.print(i+" ");
}
}
Explanation:
Simple logic
use iteration from 1 to 50
now check fro odd no each time
if number is not divisible by 2 i.e i%2!=0
print it
Hope it helps :-)
Similar questions