mastersan12

3.Google Searches****

Mar 9th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.22 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _01._Google_Searches
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int totalDays = int.Parse(Console.ReadLine());
  10.             int numberOfUsers = int.Parse(Console.ReadLine());
  11.             double money = double.Parse(Console.ReadLine());
  12.             double sum = 0;
  13.             for (int i = 1; i <= numberOfUsers; i++)
  14.             {
  15.                 int numberOfWords = int.Parse(Console.ReadLine());
  16.                 if (numberOfWords == 1 && i % 3 !=0)
  17.                 {
  18.                     sum = sum + (money * 2);
  19.                 }
  20.                 else if (numberOfWords > 1 && numberOfWords <= 5 && i % 3 != 0)
  21.                 {
  22.                     sum = sum + money;
  23.                 }
  24.                 if (numberOfWords == 1 && i % 3 == 0 )
  25.                 {
  26.                     sum = sum + ((money * 2) * 3);
  27.                 }
  28.                 else if (numberOfWords > 1 && numberOfWords <= 5 && i % 3 == 0)
  29.                 {
  30.                     sum = sum + (money * 3);
  31.                 }
  32.             }
  33.             sum = sum * totalDays;
  34.             Console.WriteLine($"Total money earned for {totalDays} days: {sum:f2}");
  35.         }
  36.     }
  37. }
Add Comment
Please, Sign In to add comment