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++ Array Programming |
Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.
I am beginner and i learn a lot of basic concept of C++ here . thanks for such a nice content
ReplyDeleteYes brother you learn and understand from our Programming Style... We are not add too much complexities in our Programmed
Delete