question 18 plz.... it's urgent
Attachments:
rohitrathee30:
....
Answers
Answered by
1
Show that 1 & only 1 out of n, n+ 1 and n + 2 is divisible by 3 where n is any positive integer?
How is Coding Ninja's online course review for Data Structures?
n is an integer. So,it is of the form 3k,3k+1 or 3k+2 where k is an integer.
If n=3k,then
n+1=3k+1,not divisible by 3
n+2=3k+2,not divisible by 3
If n=3k+1(not divisible by 3),then
n+1=3k+2,not divisible by 3
n+2=3k+3=3(k+1), divisible by 3
If n=3k+2(not divisible by 3),then
n+1=3k+3=3(k+1),divisible by 3
n+2=3k+4=3(k+1)+1,not divisible by 3
Hence by seeing all the above cases,we can safely say that:out of n,n+1 and n+2,only one is divisible by 3.
Similar questions