Write a program in java to print the following pattern: S=1/2-3/4+5/6-7/8+................
sp25:
త్వరగా జవాబు చెప్పండి రా
Answers
Answered by
3
public class series
{
public static void main (int n)
{
int p,d,s=0;
for(int I= 1;I<=n;I=I+2)
{
for(int j=2;j<=n;j=j+2)
{
if(I℅2!=0)
p=I*(-1);
else
p=I*1;
d=I/j;
s=s+d;
}
}
System.out.print(s);
}
}
{
public static void main (int n)
{
int p,d,s=0;
for(int I= 1;I<=n;I=I+2)
{
for(int j=2;j<=n;j=j+2)
{
if(I℅2!=0)
p=I*(-1);
else
p=I*1;
d=I/j;
s=s+d;
}
}
System.out.print(s);
}
}
Similar questions
Computer Science,
8 months ago
Science,
8 months ago
English,
8 months ago
Physics,
1 year ago
Physics,
1 year ago
Social Sciences,
1 year ago
Physics,
1 year ago