ماهو خرائط التدفق لهذا الكود
#include <iostream>
using namespace std;
int main() {
int n = 1000;
double sum = 0, mean, variance = 0;
double nums[n];
// Generate random numbers and calculate sum
srand(time(0));
for (int i = 0; i < n; i++) {
nums[i] = rand() % 100 + 1;
sum += nums[i];
}
// Calculate mean and reset sum to 0
mean = sum / n;
sum = 0;
// Calculate variance using formula: (sum of squared differences) / (n-1)
for (int i = 0; i < n; i++) {
double diff = nums[i] - mean;
sum += pow(diff, 2);
}
variance = sum / (n - 1);
// Display results on screen
cout << "Mean: " << mean << endl;
cout << "Variance: " << variance << endl;
return 0;
}