Created
January 20, 2021 03:18
-
-
Save thmain/0660a62e42ff351addc3b754bfcf6f90 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 ArithmeticProgressionSeries { | |
public static void printAP(int a, int d, int n){ | |
System.out.println("a = " + a +", d = " + d + ", n = " + n); | |
for (int i = 1; i <=n ; i++) { | |
int term = a + (i-1)*d; | |
System.out.print(term + " "); | |
} | |
System.out.println(); | |
} | |
public static void main(String[] args) { | |
printAP(1, 2, 5); | |
printAP(2, 5, 7); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment