Tuesday, April 12, 2022

Odd and Even Numbers Using Functions and Arrays in C++

 A simple program asks the user to give a series of numbers and then the program will display the odd and even numbers using functions and arrays using a C++ programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.


My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg


=================================================

Want to support my channel?


GCash Account


Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada

 

Thank you very much for your support





Program Listing

// Written By: Mr. Jake R. Pomperada, MAED-IT
// Date : November 21, 2010 Sunday
// Tool : C++


#include <iostream>

using namespace std;

// Global Variables

int a=0,r=0,data=0,b=0;
int values[10];


void get_data();
void display_even();
void display_odd();


void get_data(void)
{
     cout << "\n\n";
cout << "\tOdd and Even Numbers Using Functions and Arrays in C++";
     cout << "\n\n";
     cout << "How Many Numbers : ";
     cin >> data;
     cout << "\n";
        for (b=1; b <= data; b++)
            {
            cout << "Enter Item No. "
                  << b <<  " :";
            cin >> b[values];
          }
}


void display_even(void)
{

    cout << "\n\n";
    cout << "List of Even Numbers : ";
    cout << "\n\n";
        for (a=1; a<=data; a++) {
            r = a[values] % 2;
            if (r ==0) {
                cout << " " <<a[values]
                << " ";
         }

     }
}


void display_odd(void)
 {
    cout << "\n\n";
    cout << "List of Odd Numbers : ";
      cout << "\n\n";
     for (a=1; a<=data; a++) {
         r = a[values] % 2;
         if (r !=0) {
          cout << " " <<a[values]
            << " ";
         }
     }
 }
 main() {

     get_data();
     display_even();
     display_odd();
     cout << "\n\n";
     system("pause");
 }


1 comment:

  1. I read this amazing blog. Thanks for sharing. If you are looking for online professional certification, You can go through the platform of ecadema.
    fridge repair services in Rawalpindi

    ReplyDelete