select isnull(CAST(ceiling(ROUND(cast(cast(sum(value) AS NUMERIC) / cast(sum(total) AS NUMERIC) * 100 AS DECIMAL(8, 2)), 0)) AS INT), 0) as percentage
var value = 123.45; var total = 1000.1; var perc = total == 0 ? 0 : Convert.ToInt32((value * 100) / total);
double avalue = 4.0; double total = 31.0; var result = total == 0 ? 0 : Math.Round((avalue/total)*100); Console.WriteLine("{0}:{1}={2}", avalue, total, result);
var value = 4; var total = 31; var perc = (total == 0) ? 0 : (int)Math.Ceiling(value * 100.0 / total);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)