Divide that number into 2 using modulus division. Modulus division get the remainder of the division. If it has no remainders, then it's an even number. If not, then it's an odd number. Here's a pseudo code of the program.
ALGORITHM ODD_EVEN
INPUT (number)
IF (number MOD 2 == 0) THEN
DISPLAY ("Even")
ELSE
DISPLAY ("Odd")
END IF
END ODD_EVEN
Amendment: You did ask for a BASIC program:
10 INPUT X: IF X = 999 THEN STOP
20 PRINT X;: IF X/2 = INT(X/2) THEN PRINT "EVEN" ELSE PRINT "ODD"
30 GOTO 10
In pseudocode:
Given value is an integer...
If the least significant bit of value is set
Then return value * value * value
Else return value * value
To determine if the least significant bit is set or not, use the bitwise AND operator. The least significant bit is 0x1, thus value AND 0x1 returns 0x1 when the bit is set, or 0x0 when the bit is not set. However, you need to be careful with signed integers because some architectures use ones complement notation while others use twos complement. With ones complement, a negative value inverts all the bits of the equivalent positive value whereas twos complement inverts the bits and then adds one. Twos complement is more common but if you're not sure of the architecture's representation of signed values or simply want your code to be portable regardless of the representation, then use the MOD (modus) operator to find the remainder after dividing by 0x2. If the result is 0x1, then the value is odd, regardless of its sign. This is less efficient than bitwise AND but if you're certain the architecture is ones complement, then all positive odd values have the least significant bit set while all negative odd values do not (including -0 which is binary 11111110 in ones complement notation). With twos complement, however, all odd values always have the least significant bit set regardless of the sign, and zero is always represented as binary 00000000 (there is no -0 in twos complement notation).
#include<stdio.h> int main() { int side,area of square; print f("Enter the length of side\n"); scan f("%d",&side); area of square=side*side; print f(the area of square is %d\n"area of square); return 0; }
write a vb program to find the magic square
Example: int x, y; x = 5; y = x * x; // square of x System.out.println("The square of " + x + " = " + y); Put all this in your main() method. Most Java IDEs will generate the main() method automatically.
It should not be even (except for 2), and must not be dividable with any odd number between 3 and its square-root.
#include <stdio.h> void main() { int a,b,c,i,j; printf("Enter the number of rows for square matrix : "); scanf("%d",&a); for(i=1;i<=a;i++) { for(c=1,j=1;j<=a;j++,c++) { if(c==i) printf("1 "); else printf("0 "); } printf("\n"); } getch(); }
It depends on the type of calculator you have. If you have a 8-digit calculator, the largest square number you can display is 99,980,001. If you have a 10-digit calculator, the largest square number you can display is 9,999,800,001. With a TI-84, you can display 9.999999999e99 (which is actually rounded).
if it's square root is an integer, it is a square number.
You can tell whether a number is a square number by looking at the last digit. A perfect square number ends with either 1, 4, 5, 6, 9 or 00.
square and cube caculator
Try it out. Take the square root on a calculator, and see whether you get a whole number.
If your question is whether or not 177 has a square root which is an integer, then no.
WordPad is not meant to handle the typesetting and display of mathematical expressions. You can use this radical symbol: √ to display simple square roots, but you can't extend the mark above the thing you're taking the square root of. To display more complex expressions, you need a program like MathType, which is specifically designed to typeset math.
Two, a square and a trapezoid. A square is a rectangle and a parallelogram.
If the whole number is a perfect square, its square root is rational. If not, it's not.
Click the numbers to display "453" (the number of sides to square, pentagon, triangle).
#include<stdio.h> int main() { int side,area of square; print f("Enter the length of side\n"); scan f("%d",&side); area of square=side*side; print f(the area of square is %d\n"area of square); return 0; }
Click the numbers to display "453" (the number of sides to square, pentagon, triangle).