Write Java program to accept a number.if it is positive Odd write 3 successive positive Odd or write 3 predessor numbers
Answers
Answered by
0
import java.util.*;
class GFG
{
static void checksum(int n)
{
if (n == 0)
{
System.out.println("-1 0 1");
return;
}
int inc;
if (n > 0)
inc = 1;
else
inc = -1;
for (int i = 0; i <= n - 2; i += inc)
{
if (i + i + 1 + i + 2 == n) {
System.out.println(i + " " +
(i + 1) +
" " + (i + 2));
return;
}
}
System.out.println("-1");
}
public static void main(String[] args)
{
int n = 6;
checksum(n);
}
}
Answered by
3
Explanation:
answer is in attachment
mark me brainliest please
Attachments:
Similar questions
India Languages,
1 month ago
English,
1 month ago
History,
1 month ago
Hindi,
2 months ago
English,
2 months ago
Political Science,
10 months ago
Social Sciences,
10 months ago
Accountancy,
10 months ago