Computing.Net > Forums > Windows Vista > even numbers

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

even numbers

Reply to Message Icon

Name: Angel33
Date: October 8, 2009 at 14:52:46 Pacific
OS: Windows Vista
Subcategory: General
Comment:

I have to write a program that inputs a series of integers and passes them one at a time to function even, which uses the remainder operator to determine if an integer is even. The function should take an integer argument and return 1 if the integer is even and 0 otherwise. I am confused, i do not what else i have to do to return the even integer to 1 or the odd integer to 0....I have this so far:

#include <iostream>
int main()
{

int number;
printf ( "Enter a number:\n");
scanf("%d", &number);

if (number % 2 == 0)
printf ( "The number is even.");
else printf ( "The number is odd.");

system("PAUSE");

}



Sponsored Link
Ads by Google

Response Number 1
Name: Ewen
Date: October 8, 2009 at 16:59:33 Pacific
Reply:

Post this in the Programming Forum... link on the right hand side of this page.

Home Page http://ewen.uuuq.com/


0
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: even numbers

Do I even need a firewall? www.computing.net/answers/windows-vista/do-i-even-need-a-firewall/533.html

Memory problems www.computing.net/answers/windows-vista/memory-problems/87.html

XP instead of Vista? www.computing.net/answers/windows-vista/xp-instead-of-vista/956.html