Showing posts with label Find Odd Numbers. Show all posts
Showing posts with label Find Odd Numbers. Show all posts

Monday, 11 August 2014

Write a Program in C++ which Find Odd Numbers in an Array

Structure of the Problem Requirements 

In this problem we will learn how to find the odd number in an array. The program will received input from the user which is numeric values . In logic there is simple function just check where the reminder is one or greater then one just print out that numbers in from a loop . Here is the source code of the problem solution which help you in better understanding .

Source Code 

#include<iostream>
using namespace std;
int main ()
{
int num [7];
for (int i =0;i<7;i++)
{
cout<<" Enter Your Number : ";
cin>>num[i];
}
cout<<endl<<endl;
cout<<" The Odd number are: \n ";
for (int i =0;i<7;i++)
{
if (num[i]%2==1)
{
cout<<endl;
cout<<num[i];
}
}
}


Output of the Program
C++ Programming
C++ Array Programming