8 kyu

Price of Mangoes

8,645 of 32,389AartiK1

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 Trained48750
Total Skips2446
Total Code Submissions111365
Total Times Completed32389
JavaScript Completions10376
Python Completions8645
C# Completions1786
Ruby Completions640
Haskell Completions320
Elixir Completions292
C++ Completions9398
Crystal Completions17
Julia Completions54
CoffeeScript Completions27
TypeScript Completions543
C Completions769
Scala Completions41
Dart Completions153
Swift Completions182
Java Completions345
Total Stars324
% of votes with a positive feedback rating89% of 2779
Total "Very Satisfied" Votes2257
Total "Somewhat Satisfied" Votes420
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