#include <math.h>
#include <iostream>
#include <cmath>
using namespace std;
double p01 (int N)
{
double s = 0 ;
for (int i = 1; i <= N; i++) s = s + 1./(i*i);
return (s);
}
int main ()
{
int n;
cout << "N=";
cin >> n;
cout << " s=" << p01(n) << "\nπ²/6=" << M_PI*M_PI/6. << endl;
}
Computer Methods in Science Course
Friday, October 6, 2023
Subscribe to:
Post Comments (Atom)
Basic Comparison of C++ and HTML/JavaScript
Here’s a basic comparison of C++ and HTML/JavaScript for common programming concepts and simple code examples for each. This will help ...
-
ere's a concise comparison of the main operators in C++ and Python , focusing on syntax and behavior across key categories: ✅ 1. Arit...
-
Here's a clear comparison of the main operators in C++ vs. JavaScript , covering categories like arithmetic, assignment, comparison, l...
-
#include <iostream> #include <fstream> using namespace std; // Function to sort an array of integers using Selection Sort void ...
No comments:
Post a Comment