the program accepts an integer N and prints hte value N+1 if N is less than 10. else the program prints the value of N-1 in java
Answers
Answered by
1
Answer:
import java.util.*;
class valueofn {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
System.out.print("Enter N: ");
Int a = sc.nextInt();
if(n>10) {
System.out.println(n+1); }
else {
System.out.println(n-1); }
}
}
Hope this helps!
Similar questions