Q6. a) Write a program to display all the odd natural numbers found between 100 and 200 .
b) Write a program to display the sum of first 25 natural numbers using for loop. in java
Share
Q6. a) Write a program to display all the odd natural numbers found between 100 and 200 .
b) Write a program to display the sum of first 25 natural numbers using for loop. in java
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.
start = int(input("Enter the start of range: "))
end = int(input("Enter the end of range: "))
for num in range(start, end + 1):
if num % 2 != 0:
print(num, end = " ")
output:
Enter the start of range: 100
Enter the end of range:200
101, 103, 105, 107,............. 197 ,199