From d864c04c9c20ed7a238c0ea8f48cd47365a94f99 Mon Sep 17 00:00:00 2001 From: Advaya <126754021+bluevayes@users.noreply.github.com> Date: Sat, 7 Oct 2023 04:09:29 +0530 Subject: [PATCH] Created C++ Code to calculate sum of a series --- W4o5or/ELlGek.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 W4o5or/ELlGek.cpp diff --git a/W4o5or/ELlGek.cpp b/W4o5or/ELlGek.cpp new file mode 100644 index 0000000..23bf3ca --- /dev/null +++ b/W4o5or/ELlGek.cpp @@ -0,0 +1,17 @@ +#include + +int main() { + int n; + double sum = 0.0; + + std::cout << "Enter the value of n: "; + std::cin >> n; + + for (int i = 1; i <= n; ++i) { + sum += 1.0 / (i * i); + } + + std::cout << "The sum of the series is: " << sum << std::endl; + + return 0; +}