Computer Science, asked by riya92mittal, 5 months ago

program to return all odd numbers from 1 to n​

Answers

Answered by riddschauhan06
0

Answer:

find and replace ig

which class ?

Answered by praveen77jaiswal
1

Answer:

hi

Explanation:

Java Program to print Odd numbers from 1 to n or 1 to 100

BY CHAITANYA SINGH | FILED UNDER: JAVA EXAMPLES

In this example, we will write a Java program to display odd numbers from 1 to n which means if the value of n is 100 then the program will display the odd numbers between 1 and 100.

Program to print odd numbers from 1 to n where n is 100

In the following example we have provided the value of n as 100 so the program will print the odd numbers from 1 to 100.

The logic we are using in this program is that we are looping through integer values from 1 to n using for loop and we are checking each value whether the value%2 !=0 which means it is an odd number and we are displaying it. To understand this program, you should have the basic knowledge of for loop and if statement.

pls mark my answer has brilliant.

thank u.

Similar questions