Created
January 20, 2021 03:42
-
-
Save thmain/c60f02f0611bf9bfb6970d07b6d194f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ArithmeticProgressionNthTerm { | |
public static void printAPNthTerm(int a, int d, int n){ | |
System.out.println("a = " + a +", d = " + d + ", n = " + n); | |
int term = a + (n-1)*d; | |
System.out.println(n + "th term: " + term); | |
} | |
public static void main(String[] args) { | |
printAPNthTerm(1, 2, 5); | |
printAPNthTerm(2, 5, 4); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment