Hello everyone at Daniweb! This is my first post here, sorry if i do something wrong.
Ok, so just a quick background on me and where I'm at in java. This year I'm taking my first Comp Sci class as CSUN (Cal State University Northridge). I am a complete beginner when it comes to programming, you have been warned haha.
Anyway, I have to write a program that prints 10 random numbers between 1-100, then prints how many are even and how many are odd.
This is what I have so far.
import java.util.Scanner;
public class problem3{
public static void main(String[] args){
for(int i=1;i<=10;i++){
int randomNumber = (int)(99 * Math.random())+1;
System.out.println(randomNumber);
while(randomNumber % 2 == 0){
int k = 0
k++;
break;
System.out.println("you have " + z + " odd numbers");
}
while(randomNumber % 2 != 0){
int z = 0 ;
z++;
break;
System.out.println("you have " + k + " even numbers");
}
}
}
}