Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Threading;
- namespace ConsoleApp1
- {
- class Exam
- {
- static void Main(string[] args)
- {
- int days = int.Parse(Console.ReadLine());
- int daily = int.Parse(Console.ReadLine());
- int expected = int.Parse(Console.ReadLine());
- double sum = 0;
- for (int i = 1; i <= days; i++)
- {
- sum += daily;
- if (i % 3 == 0)
- {
- sum += daily * 0.50;
- }
- if (i % 5 == 0)
- {
- sum -= (sum * 0.30);
- }
- }
- if (sum >= expected)
- {
- Console.WriteLine($"Ahoy! {sum:f2} plunder gained.");
- }
- else
- {
- double percentage = (sum / expected) * 100.0;
- Console.WriteLine($"Collected only {percentage:f2}% of the plunder.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement