aspose file tools*
The moose likes Beginning Java and the fly likes Even or Odd Numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Even or Odd Numbers" Watch "Even or Odd Numbers" New topic
Author

Even or Odd Numbers

Kabs Pvt
Greenhorn

Joined: Oct 31, 2001
Posts: 3
How to generate a Random Fractional Number b/w 1 to 100.
Remove the Fractional Part of number and check the Number is odd or not..
plz help me in making this programme i want codes bcoz i got various instructions about it but didn't find any conclusion till now..
Thanks in Advance
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
This is not too difficult. Post what you've done so far.


------------------
Bosun
SCJP for the Java� 2 Platform


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Sadaf Zaidi
Greenhorn

Joined: Oct 09, 2001
Posts: 29
Try this code.
int a=(int)(Math.random()*(100-1)+1);
if(a%2==0)
System.out.println("number is even");
else
System.out.println("number is odd");
System.out.println(a);
Hope it helps
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Even or Odd Numbers