Loading...
+ Нов въпрос
EllyHer 3 Точки

## Why judge do not accept this answer? Is the same as Sania made in class.

using System;

namespace Account_Balance
{
class Program
{
static void Main()
{
int numOfOperations = int.Parse(Console.ReadLine());
int counter = 0;
double total = 0;

while (counter <  numOfOperations)
{
double deposit = double.Parse(Console.ReadLine());
if (deposit < 0)
{
Console.WriteLine("Invalid operation"!);
break;
}
Console.WriteLine(\$"Increase: {deposit:f2}");
counter++;
total += deposit;
}

Console.WriteLine(\$"Total:{total:f2}");
}
}
}

Тагове:
0
knoteva 1038 Точки

Здравей,

Коя е задачата?

0
04/11/2019 09:58:49
EllyHer 3 Точки

Zdraveite,

Account Balance. Mersi

0
knoteva 1038 Точки

Здравей,

Има една "!" извън кавичките: Console.WriteLine("Invalid operation"!);

Трябва да има празбо място след "Total": Console.WriteLine(\$"Total: {total:f2}");

0
04/11/2019 09:59:20
EllyHer 3 Точки

Mnogo Blagodarq! Tova beshe problema veche e 100/100

1
MartinMinev 2 Точки

Here, the solution:

using System;

namespace account_balance
{
class MainClass
{
public static void Main(string[] args)
{
int payments = int.Parse(Console.ReadLine());
double total = 0.00;
int counter = 1;

while (counter <= payments)

{
double amount = double.Parse(Console.ReadLine());

if (amount < 0.00)
{
Console.WriteLine("Invalid operation!");
break;
}

total += amount;
Console.WriteLine(\$"Increase: {amount:F2}");

counter++;

}

Console.WriteLine(\$"Total: {total:F2}");

}
}
}

-----------------------------------------------------------------------------

0