Arkie
Javaforums.net Admin
Senior Member
Reputation: 16
Developer @ Javaforums.net
Offline
Posts: 2593
Referrals: 13
|
 |
« on: February 04, 2009, 08:25:11 AM » |
|
Here's a source file that checks each individual number if its odd or even. GeSHi (java): /*-------------------------------------------------------------------------- OddOrEven class ***************** By: HappyFace http://www.engineeringserver.com Contact: info [@] engineeringserver.com Version: 04/FEB/2009 "***************** Note: checks if a number is odd or even. //----------------------------------------------------------------------*/ public class OddOrEven { public static void main (String[] args ){ for (int i = 0; i < strNumber.length(); i++){ if(strNumber.charAt(i)%2 !=0){ System. out. println("Odd " + strNumber. charAt(i )); } else{ System. out. println("Even " + strNumber. charAt(i )); } } } }
Created by GeSHI 1.0.7.20 OutputEven 4 Odd 5 Even 6 Even 8 Even 8 Odd 7 Odd 9
|
|
|
|
|
Logged
|
|
|
|
JVposter
Junior Member
Reputation: 0
Offline
Posts: 1
Referrals: 0
|
 |
« Reply #1 on: February 26, 2009, 05:57:26 PM » |
|
hello!
thanks for sharing!
Regards,
|
|
|
|
|
Logged
|
|
|
|
Arkie
Javaforums.net Admin
Senior Member
Reputation: 16
Developer @ Javaforums.net
Offline
Posts: 2593
Referrals: 13
|
 |
« Reply #2 on: February 26, 2009, 06:02:09 PM » |
|
hello!
thanks for sharing!
Regards,
Glad you like it, if you need more help let us know.
|
|
|
|
|
Logged
|
|
|
|
Diedes
Member
Reputation: 0
Offline
Posts: 14
Referrals: 0
|
 |
« Reply #3 on: March 21, 2009, 09:21:22 AM » |
|
How can I use that script?  I'm noob in java scripting, but can you allso use this script to check or a number is odd or even to bet on a number? Like a numbergame on a site, that you have to bet on or it will be odd or even, is there a way with a (or this) script to check the number before betting:) Thanx :) Diedes
|
|
|
|
|
Logged
|
|
|
|
Arkie
Javaforums.net Admin
Senior Member
Reputation: 16
Developer @ Javaforums.net
Offline
Posts: 2593
Referrals: 13
|
 |
« Reply #4 on: March 21, 2009, 09:25:41 AM » |
|
How can I use that script?  I'm noob in java scripting, but can you allso use this script to check or a number is odd or even to bet on a number? Like a numbergame on a site, that you have to bet on or it will be odd or even, is there a way with a (or this) script to check the number before betting:) Thanx :) Diedes It's not javascript if you mean that but you can run it by compiling the code "Javac OddOrEven" and run it by typing "Java OddOrEven" If you want javascript help however, take a look here: http://www.engineeringser.../forum/javascript-b134.0/
|
|
|
|
|
Logged
|
|
|
|
Diedes
Member
Reputation: 0
Offline
Posts: 14
Referrals: 0
|
 |
« Reply #5 on: March 21, 2009, 02:49:50 PM » |
|
Well ye, i actually don't know how to run Java anyway? Is it a program then? Cuz I never went further then html and javascript  So thats why i didn't reconised the diffrence:P Anyway can you explain how the program work, and where you can use it for?  (or add me on msn:P)
|
|
|
|
|
Logged
|
|
|
|
Arkie
Javaforums.net Admin
Senior Member
Reputation: 16
Developer @ Javaforums.net
Offline
Posts: 2593
Referrals: 13
|
 |
« Reply #6 on: March 21, 2009, 03:02:49 PM » |
|
Well ye, i actually don't know how to run Java anyway? Is it a program then? Cuz I never went further then html and javascript  So thats why i didn't reconised the diffrence:P Anyway can you explain how the program work, and where you can use it for?  (or add me on msn:P) For tutorials about Java please take a look here: http://www.engineeringser...ips_and_tutorials-b121.0/If you have a specific question or need help with coding an application you can post it in one of the boards. Other people can help u out like Jurka.
|
|
|
|
|
Logged
|
|
|
|
Diedes
Member
Reputation: 0
Offline
Posts: 14
Referrals: 0
|
 |
« Reply #7 on: March 21, 2009, 03:16:12 PM » |
|
Well sure i want to learn it but i dont have that much time for it overall.. But I can try:P
|
|
|
|
|
Logged
|
|
|
|
Arkie
Javaforums.net Admin
Senior Member
Reputation: 16
Developer @ Javaforums.net
Offline
Posts: 2593
Referrals: 13
|
 |
« Reply #8 on: March 21, 2009, 03:19:34 PM » |
|
Well sure i want to learn it but i dont have that much time for it overall.. But I can try:P
You will like it once u get the hang of it. isn't too hard when you spend time learning it. And like i said in my previous post, there are people here on the forums that are happy to help you out if you have any questions.
|
|
|
|
|
Logged
|
|
|
|
Diedes
Member
Reputation: 0
Offline
Posts: 14
Referrals: 0
|
 |
« Reply #9 on: March 21, 2009, 04:02:32 PM » |
|
Ah but btw, i still dont get where your odd/even script is for, how to use, and what it does  Could you explain me ? Or might contact me on msn?
|
|
|
|
|
Logged
|
|
|
|
Arkie
Javaforums.net Admin
Senior Member
Reputation: 16
Developer @ Javaforums.net
Offline
Posts: 2593
Referrals: 13
|
 |
« Reply #10 on: March 21, 2009, 05:31:49 PM » |
|
Ah but btw, i still dont get where your odd/even script is for, how to use, and what it does  Could you explain me ? Or might contact me on msn? If i did everything on msn the forum would be useless. The Javacode shows if a number is even or odd.
|
|
|
|
|
Logged
|
|
|
|
Diedes
Member
Reputation: 0
Offline
Posts: 14
Referrals: 0
|
 |
« Reply #11 on: March 21, 2009, 06:09:09 PM » |
|
hehe ok, but you know omerta? (barafranca.nl) There is a sub option : Gamble district, and you can play a number game there, with odd and even:P To gamble, you know, but, can you show with this script wich number the next number will be? so you can set all your money on the right number? 
|
|
|
|
|
Logged
|
|
|
|
Arkie
Javaforums.net Admin
Senior Member
Reputation: 16
Developer @ Javaforums.net
Offline
Posts: 2593
Referrals: 13
|
 |
« Reply #12 on: March 21, 2009, 07:12:18 PM » |
|
hehe ok, but you know omerta? (barafranca.nl) There is a sub option : Gamble district, and you can play a number game there, with odd and even:P To gamble, you know, but, can you show with this script wich number the next number will be? so you can set all your money on the right number?  Nope i don't, I also am pretty sure this script can't be used to see the next number. lol.
|
|
|
|
|
Logged
|
|
|
|
Diedes
Member
Reputation: 0
Offline
Posts: 14
Referrals: 0
|
 |
« Reply #13 on: March 22, 2009, 02:30:42 PM » |
|
Ohh hehe:P That was actually what I ment this script was for, but oke tobad:P
|
|
|
|
|
Logged
|
|
|
|
|