#include <iostream>
using namespace std;
int main()
{
cout << "Even from 0-100: \n\n";
for(int i = 0; i <= 100; i++)
{
if(i % 2 == 0 && i != 0)
{
cout << i << endl;
}
}
cout << "Odd from 0-100: \n\n";
for(int i = 0; i < 100; i++)
{
if(i % 2 != 0)
{
cout << i << endl;
}
}
char wait;
cin >> wait;
return 0;
}
Yes. If n is odd, then n + c where c is an even constant will be odd. n + d where d is an odd constant will be even.
no, b/c you can think of an odd number as an even number plus one. So if you add two odd numbers, you would be adding 2 even numbers plus 2... Let # be even... (#+1) + (#+1) = (#+#) + 2 two even numbers added together are always even
Even b/c if the last number is even then even and if the last number is odd then the number is odd so 986 _6_ is even
No. Two odd numbers added together always give an even number. Two even numbers added together always give an even number. An odd and an even number added together always give an odd number. So, if we have 5 odd numbers - a, b, c, d and e a + b will be even c + d will be even So if (a + b) + (c + d) is even, adding e to that will have to be an odd number - but 50 is even, so it cannot be done.
The simple explanation is based on the two rules: Odd+Odd = Even and Even+Odd = Odd Adding the first two Odd numbers (rule 1) gives an Even number. Then adding the Odd (rule 2) gives the Odd final answer. The mathemetical proof goes as follows: An odd number is one that, when divided by 2, leaves a remainder of 1. So, as odd number can always be written in the form 2x + 1 where x is an integer. Now suppose 2a+1, 2b+1 and 2c+1 are three odd numbers where a, b and c are integers. (They need not all be different). Then their sum is 2a+1+2b+1+2c+1 = 2a+2b+2c+2+1 = 2(a+b+c)+1 which is of the same form as 2x+1 (with a+b+c replacing x).
#include <iostream> int main() { int num; std::cout << "Enter a number: "; std::cin >> num; if(num % 2 == 0) { std::cout << "Number is even"; } else { std::cout << "Number is odd"; } return 0; }
Even (unless c = 0 in which case it is either or both!)
Because three odd numbers can be expressed as 2a + 1, 2b + 1 and 2c + 1. Adding these gives 2(a + b + c) + 3: 2(a + b + c) is obviously even, being a multiple of 2, and 3 is equally obviously 1 more than another even number, so your total comprises two even numbers plus 1, ie an odd number.
To write a C program to determine if something is odd or even you need to be a programmer. To write a program in C is complicate and only done by programmers.
#include <stdio.h> main() { int n, odd=0, even=0; while (scanf("%d",&n)&&(n!=0)) (n%2)?++odd:++even; printf("odd: %d even: %d\n",odd,even); }
printf ("%d is %s\n", n, n%2 ? "odd": "even");
It's impossible. Adding 5 odd numbers will always result in an odd number. 50 is an even number. Here's how. Let the five odd numbers be: 2a+1, 2b+1, 2c+1, 2d+1, and 2e+1; where a,b,c,d & e are any whole numbers. This guarantees that they are odd, since multiplying by 2 gets and even then an even plus one will be an odd. So we have 2a+1+2b+1+2c+1+2d+1+2e+1. Rearranging we have 2a+2b+2c+2d+2e+5 = 2(a+b+c+d+e) + 5. So 2(a+b+c+d+e) is even, then you add 5 and it's odd.