Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class MakeSymbols{
- public static void main(String[] args){
- Random randomGenerator = new Random();
- int count = 0;
- do{
- int randomInt = randomGenerator.nextInt(101);
- System.out.println("Random number generated: "+randomInt);
- if(randomInt%2 == 0){ //randomInt is even
- for(int i = 0; i < randomInt; i++){
- System.out.print("*");
- }
- System.out.println();
- }
- else{//randomInt is odd
- for(int i = 0; i < randomInt; i++){
- System.out.print("&");
- }
- System.out.println();
- }
- count++;
- }while(count < 3);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement