Q:

Calculate The Serious of Number Program Using Java

0

This Program is used to calculate the serious of Number Program using Java

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

// series of number program 

import java.io.*; 
import java.lang.*; 

public class ssva01 

{ 
public static void main(String arg[]) throws IOException 
{ 
float n,i; 
float a; 
BufferedReader inp=new BufferedReader(new InputStreamReader(System.in)); 
System.out.print("\n\nEnter the value of N: "); 
n=Float.parseFloat(inp.readLine()); 
a=0; 
for(i=1;i<=n;i++) 
{ 
a=a+(1/i); 
} 
System.out.println("Series of numbers: "+a); 
} 
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now