Computer Science, asked by RitamonMobile, 11 months ago

1/3+2/6+3/9+4/12+5/15 java program series. Can anyone plz solve this?​

Answers

Answered by atheesh
1

Answer:

import java.util.*;

class P1{

public static void main (String [] args) {

double n, d, sum, frac, frac_tmp;

n = 1;

d = 3;

for(int ctr =1; ctr <= 5; ctr++) {

n = n+1;

d = d + 1;

tmp_frac = (n/d) ;

sum = sum + tmp_frac;

}

frac = (1/3);

System.out.println(sum + frac) ;

}

}

Similar questions