answersLogoWhite

0


Best Answer

For positive integers, if the least significant bit is set then the number is odd, otherwise it is even.

For negative integers in twos-complement notation, if the least significant bit is set then the number is odd, otherwise it is even. Twos-complement is the normal notation, allowing a range of -128 to +127 in an 8-bit byte.

For negative integers in ones-complement notation, if the least significant bit is set then the number is even, otherwise it is odd. Ones-complement is less common, allowing a range of -127 to +127 in an 8-bit byte, where 11111111 is the otherwise non-existent value -0 (zero is neither positive nor negative).

Ones-complement allows you to change the sign of a value simply by inverting all the bits. Twos-complement is the same as ones-complement but we also add one. Thus the twos complement of 0 is 0 because 11111111 + 1 is 0 (the overflowing bit is ignored). 11111111 then becomes -1 rather than the non-existent -0.

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a program to determine whether a number is odd or even counter?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

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.


How do you write a program to find number of zeros for the given number in c program?

Assuming the number is represented by a decimal integer, initialise a counter to zero, then repeatedly divide the number by 10 and until the number is zero. After each division, examine the remainder. Each time the remainder is zero, increment the counter. If the number is represented by a decimal float, repeatedly multiply by 10 until the value is an integer, then perform the previous algorithm.


A loop control variable that is incremented a specific number of times is known as?

A loop control variable is widly known as a "counter".


Is 180 credit hours equal to MBA?

The number of credits does not determine equality to any specific program of study. Each program will have specific requirements. Once you are accepted to that program, successfully complete the requirements of that program, and the registrar indicates you have completed the program and have graduated, then you have that degree.


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.

Related questions

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.


Draw a flowchart to print prime numbers from 1 to 100?

The flowchart above starts with the number 2 and checks each number 3, 4, 5, and so forth. Each time it finds a prime it prints the number and increments a counter. When the counter hits 100, it stops the process. To determine whether a number is prime, it calls the function "IsThisNumberPrime" which is shown at the top of this page.


How to write a program to get this as answer 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5?

This Example code is written is basic. The counter variable is the Number you want to reach. You use a for loop to print from 1 to the counter number. Then you increase the counter number by 1 then go through your for loop again until you reach your counter number, and the process keeps going. Counter as Integer Counter= 1 Do For Number = 1 to Counter Print Number Next Number Counter=Counter+1 Loop


What is the code of a c program that will read in a positive integer value and determine If the integer is a prime number and If the integer is a Fibonacci number?

see the program


What is the program counter?

Counters in basic are used to count a number of times a process is being used.


Write a program By using if else statement to read a number and check whether it is positive or negative?

write a c++program by using if statement to read a number and check whether it is positive or negative


How can you determine whether the square root of a number is a rational number or an irrational number?

If it can't be expressed as a fraction then it is an irrational number


How do you find the 12th prime number using c?

To keep it simple: Write a main loop that goes through all the numbers, starting with 2, and incrementing one at a time. Determine whether each number is a prime number. If it is, increment a counter. To determine whether each number is a prime number, either use an inner loop, or a separate function. Test divisibility of the number "n" by every number from 2 to n-1. If you find a factor, then it is not a prime number. Note that you can test divisibility by using the "%" operator. For example: if (number % factor == 0) // number is divisible by factor else // it isn't


What can be used to determine whether a person has inherited a normal number of chromosomes?

A Karyotpe


How we can write C plus plus program to enter a paragraph and then calculate number of words and lines in the paragraph?

To determine the number of words, initialise a counter (0) and a bool (false). Scan the text one character at a time. If the character is a letter or a digit and the bool is false, set the bool to true and increment the counter. If the character is not a letter or digit and the bool is true, set the bool to false unless the character is a hyphen. When you're done, the counter will tell you how many words there were. To determine the number of lines, divide the string's length by the line length. If there's a remainder, round up to the next integer.


When can program counter be used?

Basically, whenever you need to count something. One common scenario is when you need to repeat a program block a certain number of times - the counter variable will be used, in this case, to keep track of how many times the program block has already been executed.


What is the value of a ten dollar note with this number B68851231B?

A bill's serial number doesn't readily identify it. It's just a counter, so it's a bit like trying to determine a car's model by giving the odometer reading. Please post a new question with the bill's date, whether it has a green or blue seal, and whether there is a small letter after/next to the date.