Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is Number is divisable by 1000

Status
Not open for further replies.

ralphtrent

Programmer
Jun 2, 2003
958
US
Hi
I need to go through a file. Every 1000 lines I hit, I want to spit out 1000 lines read, 2000 lines read, 3000 lines read, etc. etc. etc. I think I would have been able to do this with the MOD procedure in vbscript, but I do not see that in C#.

What would you recommend to get around this?

Thanks
 
The C# modulus operator is %.
Code:
if (i % 1000 == 0) ...
You can also use Decimal.Remainder:
Code:
if (Decimal.Remainder(i, 1000) == 0) ...
 
Thanks for the post, after I posted and did a little googleing, I was reminded of the %.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top