Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package zestaw;
- import java.util.Scanner;
- /**
- *
- * @author student
- */
- public class Sumator {
- private int N;
- private double suma;
- public void sumuj() {
- suma = 0;
- for (int m = 1; m <= N; m++) {
- suma = suma + 1 / Math.pow(2, m);
- }
- }
- double wypisz() {
- return suma;
- }
- public Sumator(int N) {
- this.N = N;
- suma = Double.NaN;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement