Dsa
Math
Medium
Sweet Spot Average
You are given a list of integers representing daily sales over a week. Write a function that computes the average sales for days where sales are above a certain threshold. If no days meet the criteria, return 'No sales above threshold'.
Input format:
First line contains the threshold (an integer), and the second line contains the 7 integers representing the sales for seven days.
Output format:
Print the average of the sales that exceed the threshold rounded to two decimal places, or print 'No sales above threshold' if none exist.
Example:
Input:
100
120 85 150 200 90 50 300
Output:
190.00
Key concepts
averagesfilteringmath
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now