In this

**Leetcode Survey Analysis problem solution,**WebEngage empowers companies to collect feedback and gather insights from visitors using surveys and notifications.An e-commerce company used the WebEngage customer engagement tool to ask visitors if they want to buy the selected products at discounted prices. If the visitor said 'Yes, the product was delivered to the customer at a discounted price. They collected the response for a whole week from Monday to Sunday. Now they want to analyze which day most of the people said 'Yes' compared to other days. For this, they want to calculate the standard deviation of the 'Yes' count on each day. Using the standard deviation, we have a standard way of knowing which day was extra good, which day was extra bad, and which day was just plain normal in terms of business.

## HackerEarth Survey Analysis problem solution.

```
#include <bits/stdc++.h>
using namespace std;
double days [7 + 10];
int main()
{
int n;
double sum = 0, day = 0, average, var = 0, standard_Deviation;
string s;
for(int i = 0; i < 7; i++){
cin >> s;
day = 0;
for(int j = 0; j < s.size(); j++){
if(s[j] == '1') days[i]++;
}
sum += days[i];
}
average = sum / 7.0;
for(int i = 0; i < 7; i++){
var += (average - days[i]) * (average - days[i]);
}
standard_Deviation = sqrt(var / 7.0);
printf("%.4lf\n", standard_Deviation);
return 0;
}
```

## 0 Comments