Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
unable to get percentage in decimal values ?
SUNIL GUTTA
Mar 1 2013 10:35 AM
1.5k
Reply
Hie friends
I Have written this code in note pad i am trying to pass values via command prompt i.e
after compiling : csc cmdparams.cs then after
i am passing cmdparams 70 75 64 58 79 83 73 50
using System;
class cmdparams
{
static void Main(string[] args)
{
int sum = 0;
double per = 0;
foreach (string str in args)
sum += int.Parse(str);
per = Convert.ToInt32(sum * 100 / 750);
Console.WriteLine("sum is {0}", sum);
Console.WriteLine("percentage is {0}", per);
Console.ReadLine();
}
}
problem here is when i calculate percentage i am getting round figure like 73 but in reality its 73.6 ..
-->> Here i want to display output in cmd-prompt with decimals ??
Is there any way ?
Thank you
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
C# Radiobutton
Can anyone explain that c# code, please ?