desislava_topuzakova

01. Spring Clothes

Mar 28th, 2021
809
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.25 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace Arrays
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             int countClothes = int.Parse(Console.ReadLine());
  12.             int totalSum = 0;
  13.  
  14.             for (int clothes = 1; clothes <= countClothes; clothes++)
  15.             {
  16.                 string type = Console.ReadLine();
  17.                 //проверка за типа на дрехата: t-shirt, jeans, trainers, jacket
  18.                 if(type == "t-shirt")
  19.                 {
  20.                     totalSum += 20;
  21.                     //totalSum = totalSum + 20;
  22.                 }
  23.                 else if(type == "jeans")
  24.                 {
  25.                     totalSum += 50;
  26.                     //totalSum = totalSum + 50;
  27.                 }
  28.                 else if (type == "trainers")
  29.                 {
  30.                     totalSum += 70;
  31.                     //totalSum = totalSum + 70;
  32.                 }
  33.                 else if (type == "jacket")
  34.                 {
  35.                     totalSum += 60;
  36.                     //totalSum = totalSum + 60;
  37.                 }
  38.  
  39.             }
  40.  
  41.             Console.WriteLine($"{totalSum:F2}");
  42.  
  43.  
  44.  
  45.  
  46.  
  47.         }
  48.     }
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment