N = len(arr)
count_odd = 0
for i in range(N):
if arr[i] % 2 != 0:
count_odd += 1
odd_arr = [0] * count_odd
j = 0
odd_arr[j] = arr[i]
j += 1
odd_arr.sort()
for i in range(count_odd):
print(odd_arr[i])
print("Number of odd elements:", count_odd)
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
N = len(arr)
count_odd = 0
for i in range(N):
if arr[i] % 2 != 0:
count_odd += 1
odd_arr = [0] * count_odd
j = 0
for i in range(N):
if arr[i] % 2 != 0:
odd_arr[j] = arr[i]
j += 1
odd_arr.sort()
for i in range(count_odd):
print(odd_arr[i])
print("Number of odd elements:", count_odd)