text: Program to find the sum of a Series 1 + 1 / 2 ^ 2 + 1 / 3 ^ 3 + â €¦ . . + 1 / n ^ n | C # program to calculate the following series ; Function to calculate the following series ; Driver Code
code: using System ; class Maths { static double Series ( int n ) { int i ; double sums = 0.0 , ser ; for ( i = 1 ; i <= n ; ++ i ) { ser = 1 / Math . Pow ( i , i ) ; sums += ser ; } return sums ; } public static void Main ( ) { int n = 3 ; double res = Series ( n ) ; res = Math . Round ( res * 100000.0 ) / 100000.0 ; Console . Write ( res ) ; } }