Write a program that reads 10 integers from user and then finds and prints all the Odd numbers that are divisible by 5.
(Please Only DO it by IF-Else or Nested if else) (not by loops)
#include <bits/stdc++.h>
using namespace std;
int arr[10];
int main()
{
for (int i = 0; i < 10; i++)
{
cin >> arr[i];
}
for (auto x : arr)
{
if (x % 2 == 1 && x % 5 == 0)
cout << x << '\n';
}
}
Comments
Leave a comment