For Loop - Exercises - Salary
Здравейте.
Моля за съдействие къде ми е грешката:
https://judge.softuni.bg/Contests/Submissions/View/18068571
Благодаря!
Здравейте.
Моля за съдействие къде ми е грешката:
https://judge.softuni.bg/Contests/Submissions/View/18068571
Благодаря!
Judge-submission can't be checked by other students, just add your code with your question or use a pastebin. Here's a code that gives 100%, I think the tricky part was to include the final validation when the salary hits below or equal to 0 and to print out the final sinalry when larger than 0.
Best,
Code:
using System;
namespace salary
{
class Program
{
static void Main(string[] args)
{
int tabs = int.Parse(Console.ReadLine());
int salary = int.Parse(Console.ReadLine());
for (int i = 1; i <= tabs; i++)
{
string penaltySites = Console.ReadLine();
if (penaltySites == "Facebook")
{
salary -= 150;
}
else if (penaltySites == "Instagram")
{
salary -= 100;
}
else if (penaltySites == "Reddit")
{
salary -= 50;
}
if (salary <= 0)
{
Console.WriteLine("You have lost your salary.");
break;
}
}
if (salary > 0)
{
Console.WriteLine($"{salary}");
}
}
}
}
Thank you!