I have solved this using C# console application.You can see the logic and modify in asp.net or any function in c#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MTBF
{
class Program
{
static void Main(string[] args)
{
int quantity, quantity_sum = 0;
int i=1;
string ch="";
while (i <= 10)
{
Console.WriteLine();
Console.Write("\nEnter Quantity = ");
quantity = int.Parse(Console.ReadLine());
quantity_sum = quantity_sum + quantity;
Console.Write("\nIs there a breakdown(y or n) = ");
ch = Console.ReadLine();
if (ch.Equals("y"))
{
Console.Write("\nBreakdown = " + quantity_sum);
quantity_sum = 0;
}
else
{
}
i++;
}
}
}
}
Output
Enter Quantity = 500
Is there a breakdown(y or n) = n
Enter Quantity = 400
Is there a breakdown(y or n) = y
Breakdown = 900
Enter Quantity = 300
Is there a breakdown(y or n) = n
Enter Quantity = 700
Is there a breakdown(y or n) = n
Enter Quantity = 600
Is there a breakdown(y or n) = n
Enter Quantity = 600
Is there a breakdown(y or n) = y
Breakdown = 2200
Enter Quantity =