Click here to Skip to main content
16,010,351 members
Home / Discussions / C#
   

C#

 
GeneralRe: You just missed an 'm' Pin
Pankaj - Joshi6-Jun-07 21:47
Pankaj - Joshi6-Jun-07 21:47 
GeneralRe: You just missed an 'm' Pin
CPallini6-Jun-07 22:06
mveCPallini6-Jun-07 22:06 
AnswerRe: Numer Problem Pin
Christian Graus6-Jun-07 21:08
protectorChristian Graus6-Jun-07 21:08 
GeneralRe: Numer Problem Pin
Pankaj - Joshi6-Jun-07 21:50
Pankaj - Joshi6-Jun-07 21:50 
AnswerRe: Numer Problem Pin
Guffa6-Jun-07 22:02
Guffa6-Jun-07 22:02 
GeneralRe: Numer Problem Pin
Pankaj - Joshi6-Jun-07 22:20
Pankaj - Joshi6-Jun-07 22:20 
GeneralRe: Numer Problem Pin
DavidNohejl6-Jun-07 22:56
DavidNohejl6-Jun-07 22:56 
GeneralRe: Numer Problem Pin
Colin Angus Mackay6-Jun-07 23:16
Colin Angus Mackay6-Jun-07 23:16 
pankaj.indore wrote:
Dim d as double
d=5/3
messagebox.show(k.tostring())

result 1.666666667

but in C# it give 1 whyyyyyyyyyyyyyyyy


Christian already explained it to you.

5 and 3 are both integers. If you do integer division your result will be an integer.

1.667 is not an integer.


pankaj.indore wrote:
universe know this 5/3 = 1.666666....


Only when it is doing floating point division. When it is doing integer division the result is 1.

Obviously VB performs floating point division, while C# uses integer division (unless told not to, by having the values cast before).


Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5

Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton


My website

AnswerRe: Numer Problem Pin
Guffa7-Jun-07 13:32
Guffa7-Jun-07 13:32 
Questionhi Pin
Tauseef A6-Jun-07 20:45
Tauseef A6-Jun-07 20:45 
AnswerRe: hi Pin
Sathesh Sakthivel6-Jun-07 20:49
Sathesh Sakthivel6-Jun-07 20:49 
AnswerRe: hi Pin
blackjack21506-Jun-07 20:55
blackjack21506-Jun-07 20:55 
AnswerRe: hi Pin
Guffa6-Jun-07 22:24
Guffa6-Jun-07 22:24 
QuestionGet print jobs Pin
blackjack21506-Jun-07 20:36
blackjack21506-Jun-07 20:36 
AnswerRe: Get print jobs Pin
Martin#6-Jun-07 22:36
Martin#6-Jun-07 22:36 
GeneralRe: Get print jobs Pin
blackjack21507-Jun-07 0:31
blackjack21507-Jun-07 0:31 
Questionhi all Pin
Tauseef A6-Jun-07 20:29
Tauseef A6-Jun-07 20:29 
AnswerRe: hi all Pin
Sathesh Sakthivel6-Jun-07 20:41
Sathesh Sakthivel6-Jun-07 20:41 
AnswerRe: hi all Pin
M. J. Jaya Chitra6-Jun-07 20:42
M. J. Jaya Chitra6-Jun-07 20:42 
GeneralRe: hi all Pin
Sathesh Sakthivel6-Jun-07 20:47
Sathesh Sakthivel6-Jun-07 20:47 
GeneralRe: hi all Pin
M. J. Jaya Chitra6-Jun-07 20:57
M. J. Jaya Chitra6-Jun-07 20:57 
GeneralRe: hi all Pin
Sathesh Sakthivel6-Jun-07 20:58
Sathesh Sakthivel6-Jun-07 20:58 
QuestionMerging Projects Pin
tigerpowereg6-Jun-07 20:07
tigerpowereg6-Jun-07 20:07 
AnswerRe: Merging Projects Pin
ganti.r6-Jun-07 22:43
ganti.r6-Jun-07 22:43 
QuestionChangin' Input language Pin
mrkeivan6-Jun-07 19:49
mrkeivan6-Jun-07 19:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.