Back to Editorials CodeCraft β
  • Github
  • Instagram
< >

Samosas

TIME LIMIT = 1 SEC.

  • Who doesn't love those hot, delicious samosas in the canteen every evening? The majority of the rush near the counter is only due to those samosas. Hundreds of samosas vanish in less than five minutes. Due to this, it becomes hard for the canteen people to keep track of how many samosas they sell each day. They're now asking for your help to deal with this issue.
    Given the number of samosas they sell each day in a week, print their week's average
Input Output
Six lines containing the number of samosas sold on each day. Print the average number of samosas sold that week, accurate to two decimal places.
Constraints
  • 1 ≤ Number of samosas sold each day ≤ 109
Example Test Case
Input             Output
100
200
100
300
400
500
266.67
Solution

#include <cstdio> int main() { long long int quantity[6],i; //there are only six days // quantity can be large (upto 10^9) hence using long long double sum=0; //sum can be large so using double for(i=0;i<6;i++) { scanf("%lld",&quantity[i]); sum += quantity[i]; } printf("%.2lf",sum/6.0); //printing upto 2 decimal places using .2lf (for double) return 0; }
  • #1 Thieves
  • #2 The Queue of Doubts
  • #3 Summation of Primes
  • #4 Spacious Maximus
  • #5 Samosas
  • #6 Reasonably Sound
  • #7 Product of Digits
  • #8 Prime Usernames
  • #9 Path Shifter
  • #10 Keypad Count
  • #11 Even Vowels
  • #12 Encryption
  • #13 Decryption
  • #14 Canteen Accountant
  • #15 Attendance Register
  • #16 Amazing Year

Get in touch

  • executives@codingstudio.club
  • +91 9010342360
  • Vignana Bharthi Instute of Technology
    Aushapur, Ghatkesar, Hyderabad, Telengana - India

© coding.Studio();