Advertisement
bullit3189

Rage Expenses - Intro and Basic Syntax

Jan 24th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5.  
  6. public class Program
  7. {
  8. public static void Main()
  9. {
  10. int lostGames = int.Parse(Console.ReadLine());
  11. decimal headsetPrice = decimal.Parse(Console.ReadLine());
  12. decimal mousePrice = decimal.Parse(Console.ReadLine());
  13. decimal keyboardPrice = decimal.Parse(Console.ReadLine());
  14. decimal displayPrice = decimal.Parse(Console.ReadLine());
  15.  
  16. int headsetCounter =0;
  17. int mouseCounter =0;
  18. int keyboardCounter =0;
  19. int displayCounter =0;
  20.  
  21.  
  22. for (int i=1; i<=lostGames; i++)
  23. {
  24. if (i%2==0)
  25. {
  26. headsetCounter++;
  27. }
  28. if (i%3==0)
  29. {
  30. mouseCounter++;
  31. }
  32. if (i%6==0)
  33. {
  34. keyboardCounter++;
  35. }
  36. if (i%12==0)
  37. {
  38.  
  39. displayCounter++;
  40.  
  41.  
  42. }
  43. }
  44.  
  45. decimal totalCost = (headsetPrice*headsetCounter) + (mousePrice*mouseCounter) + (keyboardPrice*keyboardCounter) + (displayPrice*displayCounter);
  46.  
  47. Console.WriteLine("Rage expenses: {0:f2} lv.",totalCost);
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement