Computer Science, asked by sreya005, 11 months ago

java program pls solve kindly i need today plss​

Attachments:

Answers

Answered by buddhdev2
1

Answer: See here!

Explanation: public class s

{

public static void main(int n)

{

double x; double sum=0;int p=1;

for(int i=0;i<n;i++)

{

x=Math.sqrt(n);

if(i%2==0)

{

sum=sum+x;

}

else if(i%2!=0)

{

sum=sum-x;

}

p=p+2;

}

System.out.print(sun);

}

}

Similar questions