I want to achieve the following: Whatever number may be printed to the console, it has to have 2 digits after the decimal mark. When the result is a decimal number, the program rounds it off to 2 digits after the decimal mark, so this is fine. The problem is, however, that whole numbers don't get .00 attached to them, i.e. 100 gets printed as 100, and not as 100.00 as I want it to. I've been struggling with this for quite a while so I any help will be highly appreciated.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TorrentPirate
{
class Program
{
static void Main(string[] args)
{
int megabytes = int.Parse(Console.ReadLine());
int cinemaPricePerMovie = int.Parse(Console.ReadLine());
int wifeSpendingHour = int.Parse(Console.ReadLine());
TimeSpan time = TimeSpan.FromSeconds(megabytes/2);
double downloadTime = time.TotalHours;
double downloadPrice = wifeSpendingHour * downloadTime;
int NumberOfMoviesDownloaded = megabytes / 1500;
double cinemaPrice = NumberOfMoviesDownloaded * cinemaPricePerMovie;
if (cinemaPrice >= downloadPrice)
{
downloadPrice = Math.Round(downloadPrice, 2);
Console.WriteLine("{0} -> {1}lv", "mall", Convert.ToDecimal(downloadPrice));
}
else
{
cinemaPrice = Math.Round(cinemaPrice, 2);
Console.WriteLine("{0} -> {1}lv", "cinema", Convert.ToDecimal(cinemaPrice));
}
}
}
}