8 kyu

Price of Mangoes

10,383 of 32,413AartiK1

Description:

Accountant time! For a given quantity and price (per mango), calculate the total cost of the mangoes.
But! Every third mango is free!

Examples

# πŸ₯­ : Paid mango
# πŸ†“ : Free mango

Quantity = 2
Price = 3
Total cost ==> 6    
# Paid 2 mangoes for $3 per unit = $6; no mango for free
# πŸ₯­πŸ₯­

Quantity = 3
Price = 3
Total cost ==> 6    
# Paid 2 mangoes for $3 per unit = $6; +1 mango for free
# πŸ₯­πŸ₯­πŸ†“

Quantity = 5
Price = 3
Total cost ==> 12   
# Paid 4 mangoes for $3 per unit = $12; +1 mango for free
# πŸ₯­πŸ₯­πŸ†“   πŸ₯­πŸ₯­

Quantity = 9
Price = 5
Total cost ==> 30   
# Paid 6 mangoes for $5 per unit = $30; +3 mangoes for free
# πŸ₯­πŸ₯­πŸ†“   πŸ₯­πŸ₯­πŸ†“   πŸ₯­πŸ₯­πŸ†“
Fundamentals

Similar Kata:

More By Author:

Check out these other kata created by AartiK1

Stats:

CreatedAug 7, 2016
PublishedAug 7, 2016
Warriors Trained48775
Total Skips2446
Total Code Submissions111431
Total Times Completed32413
JavaScript Completions10383
Python Completions8651
C# Completions1787
Ruby Completions641
Haskell Completions321
Elixir Completions293
C++ Completions9405
Crystal Completions18
Julia Completions55
CoffeeScript Completions28
TypeScript Completions544
C Completions771
Scala Completions42
Dart Completions155
Swift Completions183
Java Completions351
Total Stars323
% of votes with a positive feedback rating89% of 2780
Total "Very Satisfied" Votes2257
Total "Somewhat Satisfied" Votes421
Total "Not Satisfied" Votes102
Ad
Contributors
  • AartiK1 Avatar
  • Blackstaff Avatar
  • GiacomoSorbi Avatar
  • suic Avatar
  • anter69 Avatar
  • myjinxin2015 Avatar
  • Chrono79 Avatar
  • Dentzil Avatar
  • kazk Avatar
  • user5036852 Avatar
  • Blind4Basics Avatar
  • jedau Avatar
  • Voile Avatar
  • rowcased Avatar
  • monadius Avatar
  • hobovsky Avatar
  • ejini战η₯ž Avatar
  • Just4FunCoder Avatar
  • TheWoodenMan Avatar
  • KayleighWasTaken Avatar
  • Chappuccetto Avatar
  • Bivvercode Avatar
  • Tester_blck Avatar
  • saudiGuy Avatar
Ad