Computer Science, asked by SAMRIDDHIBOSE, 11 months ago

Write a program in Java to print odd no.s from 1 to 100.​

Answers

Answered by neelrambhia03
3

Answer:

import java.util.*;

class OddNumber

{

public static void main(String args[])

{

System.out.println("The Odd Numbers are:");

for (int i = 1; i <= 100; i++)

{

if (i % 2 != 0)

{

System.out.print(i + " ");

}

}

}

}

Hope this helps you.

Answered by Anonymous
0

//java program using for loop

import java.io.*;

public class Odd

{

public static void main (String args [])

{

for(i=1, i<=100, i++)

{

if(i%2 !=0)

{

System.out.println("Odd numbers" "+i);

}

}

}

}

Similar questions