Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static int f(int n){
- if (n==1)
- return 1;
- else
- return f(n-1)+2;
- }
- public static void main(String[] args) {
- int n;
- n = new Scanner(System.in).nextInt();
- System.out.println(f(n));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement