Skip to content
Programmingoneonone
Programmingoneonone
  • Home
  • CS Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programmingoneonone

HackerEarth Survey Analysis problem solution

YASH PAL, 31 July 2024
In this HackerRank 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

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("%.4lfn", standard_Deviation);

return 0;
}
coding problems solutions

Post navigation

Previous post
Next post

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2025 Programmingoneonone | WordPress Theme by SuperbThemes