Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regular Expression for any number divisible by 60 using C# .Net?

I need to apply validation on input time intervals that are taken in as seconds. Now i am not really good at Regular expressions. So can any body help making a regular expression that can test whether a number is divisible by 60.

I was wondering if i could use to test one that check that the number is divisible by 10 and then check whether the same is divisible by 6.

For number divisible by 10 here [\d*0] is the expression i guess. Please correct me if i am wrong.

Hope somebody solves my problem.

Thanks

like image 216
Steve Johnson Avatar asked Mar 12 '10 04:03

Steve Johnson


People also ask

How do you know if a number is divisible by 60?

For a number to be divisible by 60, it must be divisible by 2, 3 and 10. Therefore: If the sum of digits of number is not divisible by 3, or. If there is no digits which is divisible by 2, or.

How do you find divisibility by 7 in C?

Divisibility by 7 can be checked by a recursive method. A number of the form 10a + b is divisible by 7 if and only if a – 2b is divisible by 7. In other words, subtract twice the last digit from the number formed by the remaining digits. Continue to do this until a small number.


1 Answers

Why not do N % 60 ?

Why you want to use regex for a job which can easily be done using one operator ?

like image 124
codaddict Avatar answered Oct 07 '22 22:10

codaddict