- Trending Categories
- Data Structure
- Operating System
- C Programming
- Social Studies
- Fashion Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
$n^2 - 1$ is divisible by 8, if $n$ is
(A) an integer
(B) a natural number
(C) an odd integer
(D) an even integer
$n^2 - 1$ is divisible by 8.
We have to find the correct option.
Let $a = n^2 - 1$ where $n$ can be even or odd.
When $n$ is even,
$n = 2k$, where $k$ is an integer.
$a = (2k)^2 - 1$
$a = 4k^2 - 1$
For $k = -1$,
$a = 4(-1)^2 - 1$
$= 4 - 1$
$= 3$ which is not divisible by 8.
For $k = 0$,
$a = 4(0)^2 - 1$
$= 0 - 1$
$= -1$, which is not divisible by 8.
When $n$ is odd, $n = 2k + 1$, where $k$ is an integer,
$a = (2k+1)^2-1$
For $k = 1$,
$a=4(1)(1 + 1)$
$= 8$ which is divisible by 8.
Hence, we can conclude from the above two observations that if $n$ is odd, then $n^2 - 1$ is divisible by 8.
- Count of m digit integers that are divisible by an integer n in C++
- Count even and odd digits in an Integer in C++
- How to check if an input is an integer using C/C++?
- Maximum positive integer divisible by C and is in the range [A, B] in C++
- Minimum positive integer divisible by C and is not in range [A, B] in C++
- C++ Program to check if input is an integer or a string
- Print first k digits of 1/n where n is a positive integer in C Program
- Find N digits number which is divisible by D in C++
- Add a positive integer constraint to an integer column in MySQL?
- Pass an integer by reference in Java
- Count pairs (a, b) whose sum of squares is N (a^2 + b^2 = N) in C++
- Python - Given an integer 'n', check if it is a power of 4, and return True, otherwise False.
- Python - Given an integer 'n', check if it is a power of 3, and return True, otherwise False.
- Reverse an Integer in Java
- Convert an integer to a hex string in C++