write a program to print the following series:
Attachments:
Answers
Answered by
1
#codeSnippet using Java.
void main(int n,int a)
{ double sum=0.0;
for(int i=0;i<=n;i++)
{
sum=sum+1/Math.pow(a,i);
}
System.out.println("Sum="+sum);
}
void main(int n,int a)
{ double sum=0.0;
for(int i=0;i<=n;i++)
{
sum=sum+1/Math.pow(a,i);
}
System.out.println("Sum="+sum);
}
Similar questions