Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lab1;
- import static java.lang.Math.*;
- import java.util.Scanner;
- public class Lab3_2_while {
- public static void main(String[] args) {
- double a,e,s1,s2;
- int k = 1, j = 1, L, M;
- Scanner input = new Scanner(System.in);
- System.out.print("L");
- L = input.nextInt();
- System.out.print("M");
- M = input.nextInt();
- System.out.print("a");
- a = input.nextDouble();
- input.close();
- e = 1.0;
- s1 = 0;
- s2 = 0;
- while (k<= M) {
- e *= a * (pow(k,2)+1.0);
- s2 += (pow(k,2)/(a+1.0));
- k++;
- }
- while (j<=L) {
- s1 += ((j+2.0)/j);
- j++;
- }
- System.out.print(e+s1-s2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement