19 iulie 2011

round down a number + transformare din mp in ari + ha

  static public decimal ariha(decimal suprafata, string ince)
            {
                decimal rez = 0;
                int ha = 0;
                decimal ari = 0;
                ha =System.Convert.ToInt32( (suprafata) / 10000);
                //ca sa rotunjeasca doar in minus...
                if ((suprafata - ha*10000)<0)
                {
                    ha--;
                }
              
                ari = suprafata - ha * 10000;
                ari = ari / 100;
                if (ince == "ari")
                {
                    rez = ari;
                }
                else
                {
                    rez = ha;
                }


                return rez;



            }

Niciun comentariu:

Trimiteți un comentariu