Last active
October 22, 2020 04:57
-
-
Save anjoismysign/7957f3d7fa521d08a00c1707cf48112b to your computer and use it in GitHub Desktop.
10/16 Assignment Algebra 2 (1.2 version)
This file contains hidden or 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 October16Assignment{ | |
public static void main(String []args){ | |
double a = 15; | |
int term = 11; | |
boolean ar = true; | |
//////////////////////////// | |
//Updated on October 21st// | |
//////////////////////////// | |
double result = 0; | |
double first = a; | |
if (ar == true){ | |
double d = -1.5; | |
System.out.println("Day 1) " + first); | |
for (int i = 0; i < term - 1; i++) { | |
int iTerm = i + 2; | |
result = a += d; | |
System.out.println("Day " + iTerm + ") " + String.valueOf(a)); | |
} | |
System.out.println(" "); | |
System.out.println("Explicit formula:"); | |
System.out.println(" an = " + first + "+(n-1)(" + d + ")"); | |
} | |
else { | |
int r = -3; | |
System.out.println("Term 1) " + first); | |
for (int i = 0; i < term - 1; i++) { | |
int iTerm = i + 2; | |
result = a *= r; | |
System.out.println("Term " + iTerm + ") " + String.valueOf(a)); | |
} | |
System.out.println(" "); | |
System.out.println("Explicit formula:"); | |
System.out.println(" an = " + first + "*(" + r + ")^n-1"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment