Find the sum of series 3 , | Java program to find sum upto N term of the series : 3 , - 6 , 12 , - 24 , ... . . ; calculate sum upto N term of series ; Driver code
import java . util . * ; class solution { static int Sum_upto_nth_Term ( int n ) { return ( 1 - ( int ) Math . pow ( - 2 , n ) ) ; } public static void main ( String arr [ ] ) { int N = 5 ; System . out . println ( Sum_upto_nth_Term ( N ) ) ; } }