-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathoverload.java
More file actions
45 lines (37 loc) · 804 Bytes
/
overload.java
File metadata and controls
45 lines (37 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.io.*;
class overload
{
public static void Series(int no)
{
int s=1,i;
for(i=5;i<=no;i+=4)
s=s+1/i;
System.out.println(s);
}
public static void series(int a, int n)
{
int j=2,sq,i; double p,su=0;
for(i=1;i<=n;i++)
{
sq=i*i;
if(j<=n)
j=j+3;
p=Math.pow(a,j);
su = su+ sq/p;
}
System.out.println(su);
}
public static void main (String args[])throws IOException
{
InputStreamReader in = new InputStreamReader(System.in);
BufferedReader y = new BufferedReader(in);
int a1,n1,no1;
System.out.println("enter a no.");
no1=Integer.parseInt(y.readLine());
Series(no1);
System.out.println("enter 2 no.");
n1=Integer.parseInt(y.readLine());
a1=Integer.parseInt(y.readLine());
series(a1,n1);
}
}