Sunday, September 10, 2017

Math.pow

Challenge:










Solution:
import java.util.*;

class lab3_3{





public static void main (String[]args)
{  
Scanner in=new Scanner(System.in);
int x;
double totalValue;

System.out.println("Enter the value of X: ");
x=in.nextInt();
//(Math.pow(x1-x2,2)+Math.pow(y1-y2,2));
totalValue = (1+x+(Math.pow(x, 2)/2)+(Math.pow(x, 3)/6)+(Math.pow(x, 4)/24));

System.out.println("The total value is: " + totalValue);

}
}

No comments:

Post a Comment