answersLogoWhite

0


Best Answer

#include
#include

int main(int argc, char *argv[]){
if(argc != 2) {
printf("pass one integer as an argument.\n");
exit(1);

}
if(atoi(argv[1]) % 2){
printf("That is an odd number\n");

}else{
printf("That is an even number\n");

}
return 0;

}

User Avatar

Wiki User

βˆ™ 15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

βˆ™ 14y ago

CLS

PRINT "PROGRAM: Find if number is odd/or, even"

PRINT

INPUT "Enter number: ", number$

number% = VAL(number$)

PRINT

PRINT "The number is ";

IF number% MOD 2 = 0 THEN

PRINT "even."

ELSE

PRINT "odd."

END IF

END

This answer is:
User Avatar

User Avatar

Wiki User

βˆ™ 9y ago

In twos-complement notation, if the least-significant bit is set, then the number is odd, otherwise its even.

In ones-complement notation, positive values follow the convention of twos-complement values while negative values use the opposing convention, if the least-significant bit is set then the number is even, otherwise it is odd.

A slower method but one that is common to both ones-complement and twos-complement is to use the modus of the value. The modus of a value is the remainder after dividing by another value. If the other value is 2 then the modus can only be 0 (even) or 1 (odd).

This answer is:
User Avatar

User Avatar

Wiki User

βˆ™ 14y ago

In Java:

if (myNumber % 2 == 0)

System.out.println("The number is even.");

else

System.out.println("The number is odd.");

Similar in C or C++. The % operator is also used to check the remainder of a division, but you would have to change the output command.

This answer is:
User Avatar

User Avatar

Wiki User

βˆ™ 15y ago

Get number

Divide number by 2 and store remainder

if remainder equal 0 print "Even"

if remainder equal 1 print "odd"

end program

This answer is:
User Avatar

User Avatar

Wiki User

βˆ™ 14y ago

I need the program that can display this number

4

12

44

444

5555

66666

This answer is:
User Avatar

User Avatar

Wiki User

βˆ™ 15y ago

bool IsNumberEven(int number)

{

if (number%2 == 0)

return true;

return false;

}

This answer is:
User Avatar

User Avatar

Wiki User

βˆ™ 13y ago

Number = Val(Textbox1.text)

If Number Mod 2 = 0 then

MsgBox("It is even.")

End If

If Number Mod 2 <> 0 then

MsgBox("It is odd.")

End If

This answer is:
User Avatar

User Avatar

Wiki User

βˆ™ 14y ago

void main()

{

int n;

printf("enter number :- ");

scanf("%d",&n);

(n%2==0)?"number is even" : "number is odd ";

getch();

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a programe to find whether a number is odd or even?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write an algorithm to check whether the given number is odd or even?

Type your answer here... i think we should first enter 1 number then check it


How do you draw a Flowchart to find whether the given number is odd or even using counter?

first we write start and then read number and after that check the number is totaly divide by 2 or not if number is totally divide by 2 then number is even else number is odd.


How do you write a C program to check whether the number is odd or even Ps-using DEV complier?

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.


Any integer is input through the keyboard write a c program to find out whether it is an odd number or even number?

printf(\n "ENTER THE NUMBER\t"); scanf{"%d",&amp;a); while(a!=0); { r=a%2; if(r==0) printf("\n\n THE NUMBER IS EVEN \t"); else printf("\n\n THE NUMBER IS ODD \t"); printf ("\n ENTER THE NUMBER \t"); scanf("%d",&amp;a); } getch(); }


What sign is the rational number if it is even?

The sign of a rational number does not depend on whether it is odd or even.


Test whether a number is even or add?

A number is even when you can divide it by 2. Ex: 44/2=22 (even) 18436/2=8218 (even) 165/2=82.5 (odd)


How do you write an odd number with even numbers?

If you add, subtract, or multiply two even numbers, you will get an even number. If you divide an even number by another even number, you may get an even number, an odd number, or even a fraction.


How can you tell whether the product of an addition problem will be odd or even?

whenever you add an even number the answer will be the same (odd/even) as the other number


How can you tell whether a given number is a multiple of 2?

If it is even


Test whether a number is even or odd?

An even number can be divided by 2 evenly. An odd number will have a remainder of 1 when divided by 2.


How can your tell whether a number is even or odd?

An even number can be divided by 2 evenly. An odd number will have a remainder of 1 when divided by 2.


How can you use the prime factorization of a number to determine whether the number is even or odd?

If the factorization includes the number 2, it's even. If not, it's odd.