TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
SUNIL GUTTA
NA
1k
392.9k
unable to get percentage in decimal values ?
Mar 1 2013 10:35 AM
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
Reply
Answers (
3
)
C# Radiobutton
Can anyone explain that c# code, please ?