You are here:

C++/c++ programing question

Advertisement


Question
I'm not so good in c++ so I've tried to answer these questions but i couldn't, so i would like to get your help please as soon as possible.. write a program to input 10 numbers and print only the even ones. thanks allot.

Answer
Hi Dear Jordan !

Sorry for the delay in responding your query :(  please find the programme below

#include <iostream.h>
#include <iomanip.h>

int main()
{
  int _Array[10];

  cout<<"Enter 10 numbers"<<endl;
  for(int _iIndex = 0 ; _iIndex < 10 ; _iIndex++)
     cin>>_Array[_iIndex];

  cout<<"Even Numbers :"<<endl;
  for(_iIndex = 0 ; _iIndex < 10 ; _iIndex++)
     if(_Array[_iIndex] % 2 == 0)
        cout<<_Array[_iIndex]<<endl;

  return 0;
}


feel free to get back to me in case of issues or if you require more explanation :)

Thanks and Regards
Prince M. Premnath

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Prince M. Premnath

Expertise

Years of research in C/C++ Will bring you all facts regarding , OOPS , SVGA , MOUSE , BIOS , IVT , Feel free to query me :-)

Experience

More than 5 years

Education/Credentials
MCA

©2012 About.com, a part of The New York Times Company. All rights reserved.