problem with number/number=number ?

hi

i need for below

1/36 = 0,0277777777777778 but result should be 1

3/36 should be 1

35/36 should be 1..... (between 1 and 36)/36 should be 1

36/36  and 37/36 and 45/36 and 71/36 should be 2

 (between 72 and 37)/36 should be 2

 (between 107 and 73)/36 should be 3  and go on

how can i do it ?

Thanks


Mark as me if my question or my answer can be helpful for you :)
0
oguzkaygun
3/1/2009 1:09:44 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

5 Replies
1773 Views

Similar Articles

[PageSpeed] 22

Hi,

I think that

(int)(n / 36) + 1

will do the trick 

0
Matti
3/1/2009 2:01:23 PM

hi

it work true without below  result 1 for 1/36 and 4 /36 and 35 /36 .. it is true.. but

result 2 for 36/36 . result should be 1

result 3 for 72/36. result should be 2

how can i fix it ? my code is below

TextBox3.Text = (Int(Convert.ToDouble(TextBox1.Text) / Convert.ToDouble(TextBox2.Text)) + 1).ToString

thanks


Mark as me if my question or my answer can be helpful for you :)
0
oguzkaygun
3/1/2009 2:33:02 PM

This is how you'll have to do

int no1 = 1;

int no2 = 23;

int intRes = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(Convert.ToDouble(no1) / Convert.ToDouble(no2))));


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
3/1/2009 3:19:25 PM

Did you checked Math.Ceiling method? Something like this will work for you.. 

Response.Write( Math.Ceiling(Convert.ToDouble("1") / Convert.ToDouble("36")));
 

My Blog


"Don't be afraid to be wrong; otherwise you'll never be right."
0
budugu
3/1/2009 3:24:59 PM

hi

thanks u Mudassarkhan and other friends

it works perfect :)

i hope you will solve my other problem.. Link is below

http://forums.asp.net/t/1390862.aspx

Thanks


Mark as me if my question or my answer can be helpful for you :)
0
oguzkaygun
3/1/2009 3:33:26 PM
Reply:

Similar Artilces:

When is a number not a number?
I've got some server script that determines the "SELECTED" entry in a SELECT control. (The code below is a snippet.) If no information is returned then I want the number defaulted a hard-coded value, otherwise, I want number that matches the returned value selected. The defaulted, hard-coded value works but the comparison (i == val) doesn't work if a a value was returned in the information. I've verified that it is indeed a number within the range I want. Why would this comparison fail like this? TIA Alan Rosine <snip> if (docInfo.advPayMonths =...

phone numbers dialing (skype) by clicking the number in web page
Name: konicek Email: jkonicekatvolnydotcz Product: Firefox Summary: phone numbers dialing (skype) by clicking the number in web page Comments: how can I switch on phone numbers dialing (skype) by clicking the number in web page? Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.9.0.2) Gecko/2008091620 Firefox/3.0.2 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

Random number excluding a number.
i have been playing around with random numbers and to get a random number between say 1 and 100 i use a code like this : System.Random RandNum2 = new System.Random(); int MyRandomNumber2 = RandNum2.Next(1, 100); but if i want to get a number between 1 and 100 excluding the number 50. is this possible? thanks Si  Kind of a funny concept for random, but you could put the calls to random in a loop and exit when the result is not 50. blink18jew:i have been playing around with random numbers and to get a random number between say 1 and 100 i use a code like this : ...

Number of User, Number of Connections
Hi, Does open client provide a mechanism to write an application that will alow me to monitor the number of users and connections to a database? Regards, San > Does open client provide a mechanism to write an application that will alow > me to monitor the number of users and connections to a database? I do not think Open Client has a way to do it, but I think the easiest is to select the info from master.dbo.sysprocesses Stephan On Sun, 12 Aug 2001 16:18:03 -0400, Stephan Marais <smarais@mindspring.com> wrote: You could write an openclient application tha...

Re-number week numbers?
Is it possible to have week numbers off-set i.e.. for educational use week 1 is beginning of September ....... ...

VB.NET: How to convert hexadecimal number to normal (decimal) number?
Hi to all VB.NET function Hex() converts numbers to hexadecimal strings, is there any reverse function that converts hexadecimals back to numbers?? Thanks, Hooker Hi, how are you? In C#, we have something like: Convert.ToInt32(string strValue, int Base)... So I basically can do: Int iDecimal = Convert.ToInt32("AF8", 16); I'm pretty sure there must be something like it on VB.Net. Hope this Helps, Covohttp://covodev.blogspot.com/"Everything should be made as simple as possible, but not simpler", A. Einstein That should work, thanks. I'm fine, BTW...

Number of connections (spid numbers)
Since upgrading from 11.9.2 to 12.5.1, I have noticed a significant increase in the spid number assigned to connections. Actually, it broke an application that captures @@spid to a 3-char field. I usually have no more than between 300 and 400 concurrent connections with anywhere from 30 - 50 new connections each hour (per sysmon). The spid numbers are now reaching over the 1000 mark. Has anything changed in how spid numbers are assigned? I assumed that a spid number is assigned either by one thats been previously assigned and available or the next highest number sequentially. If I ch...

Replace number with Number+R
Using vb.net 2005 I want to do the following: I have a formula, ex, something like 1 + 2 + ((3 + 4 + 5)/4) and I want to replace each number with number+R ex: 1R + 2R +....   and so on. whats a good code snippet to do this?  I am thinking some regexp will do the trick. think i just got it: someString = System.Text.RegularExpressions.Regex.Replace(someString , "\d+", "$&R")...

Check for number of Numbers in a string
Hi all, Need some help here. I know in C++ and Java, I can check for the number of Numbers in sa string. One example is "RN12" will have 2 numbers while "RN1234" will have 4. How do I do it in VB.net? Thanks for all the help!SGDOTNET.ORG I know there has to be a better way but couldn't you just write an for next statement to analyze the string? Imports Microsoft.VisualBasic.Information For i = 0 to myString.Length() Step 1 If IsNumeric(Mid(myString,1,1)) Then '//Do something really neat End If Next You may have to tweak that ...

number
Hi there I'm a new bird to Perl - and I have a little problem. I have a file input where I split the file into an array and that works fine, but there is some "spam" in the beginning of the file I want to get rid of - the problem is that I never know how many lines there is with this "spam"! Therefore I want to make a check that excludes all lines there doesn't start with a number in other languages I would make a check like If (! isNaN(string)) { ..... } How do I make this check In Perl? I haven't been able to find something similar in ...

Number
Hello,What should be the data type for holding numbers with 2 decimal places (2.32, 4.23, 1.23, ...)?Thanks,Miguel You could use the double datatype double decimalNumber = 12.21; for more about datatypes check this link HCHaissam Abdul MalakMCAD.NET| Blog | u can use double.parse or System.Math.Round functions  have a look at the code below  double number = 123456.646;number = double.Parse(number.ToString("####0.00")); Decimal d = 17.3501m;d = Math.Round(d, 2);Arshad Rasheed - MCPFree ASP.Net & Ajax books Please mark the most helpful reply/replies as "Answer"...

number
How to get host name and port number from my computer please send me the details HttpContext.Current.Request.Url.Host HttpContext.Current.Request.Url.Port  --------------------------------------------------------Don't forget to click "Mark as Answer" on the post(s) that helped you.NHibernate with ASP.net Problem-Design-Solution sample applicationScott ASP.net blog   HttpContext.Current.Request.Url.Host HttpContext.Current.Request.Url.PortRegardsNicsam[!!!!!!!Hopes this helps you!!!!!!!]...

number
Name: panda-fighter@yandex.ru Email: panda-fighteratyandexdotru Product: Minefield Summary: number Comments: 75215 Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:2.0a1pre) Gecko/2008051003 MRA 5.3 (build 02560) Minefield/4.0a1pre From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

Number
Hello,Inside a GridView I am accessing a value of the datasource:DataBinder.Eval(gvrContainer.DataItem, "Average")I know this is of type Double. I want to round it and change it to integer.How can i do this?Thanks,Miguel  Either of the following.(replace "num" with your column name "Average") <asp:TemplateField HeaderText="num" SortExpression="num"> <ItemTemplate> <asp:Label ID="Label2" runat="server" Text='<%# Eval("num", "{0:F0}") %>'></asp:Label> </ItemTemplate> </asp:TemplateField>   <asp:BoundField DataField="num" HeaderTex...

Web resources about - problem with number/number=number ? - asp.net.web-forms

Resources last updated: 12/21/2015 1:09:47 AM