Професионална програма
Loading...
Esskalibur_sf avatar Esskalibur_sf 0 Точки

Благотворителна кампания! Какво бъркам в кода?Благодаря!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Charity Campaign 
{
    class Program
    {
        static void Main(string[] args)
        {

            int days = int.Parse(Console.ReadLine());
            int confectioners = int.Parse(Console.ReadLine());
            int cakes = int.Parse(Console.ReadLine());
            int waffles = int.Parse(Console.ReadLine());
            int pancakes = int.Parse(Console.ReadLine());
            double sumCakes = cakes * 45;
            double sumWaffles = waffles * 5.80;
            double sumPancakes = pancakes * 3.20;
            double sumTotalOfDay = 8 * (sumCakes + sumWaffles + sumPancakes);
            double sumTotalForCampaign = sumTotalOfDay * 20;
            double sumTotalForCosts = sumTotalForCampaign-(sumTotalForCampaign/8); 

            Console.WriteLine($"{sumTotalForCosts:F2}");

        }
    }
}
 

Тагове:
0
Programming Basics
spiderman avatar spiderman 5 Точки

Ето го моето решение.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Charity_Campaign
{
    class Program
    {
        static void Main(string[] args)
        {
            int days = int.Parse(Console.ReadLine());
            int bakers = int.Parse(Console.ReadLine());
            int cakes = int.Parse(Console.ReadLine());
            int waffles = int.Parse(Console.ReadLine());
            int pancakes = int.Parse(Console.ReadLine());

            double totalCakesPrice = cakes * 45;
            double totalWafflesPrice = waffles * 5.80;
            double totalPancakesPrice = pancakes * 3.20;

            double totalMoneyForADay = (totalCakesPrice + totalWafflesPrice + totalPancakesPrice) * bakers;

            double totalMoney = totalMoneyForADay * days;

            double expenses = totalMoney - (totalMoney / 8);

            Console.WriteLine("{0:F2}", expenses);
        }
    }
}

 

0
Esskalibur_sf avatar Esskalibur_sf 0 Точки

Благодаря !

0