How to calculate Round calculations Using C#

                               
Here can u take monthly calculation to Round ur values u will get the Values in Result 

double sample= (((double)(Field1).(Field2)) / 12.0);
                                string[] str = sample.ToString().Split('.');
                                int i = str.Count();
                                double values = 0;
                                if (i > 1)
                                {
                                    values = Convert.ToDouble("0." + i);
                                }
                                double result;
                                if (values < 0.5)
                                {
                                    result= Convert.ToDouble(str[0]);
                                }
                                else
                                {
                                    result= Convert.ToDouble(str[0]) + 0.5;
                                }



Result will come 0.5/1/1.5/-----

Comments

Popular posts from this blog

Reverse Sentence using c#

How to write Pure java script Program?