Advertisement
Guest User

Untitled

a guest
Mar 4th, 2015
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import java.util.Random;
  2.  
  3. public class MakeSymbols{
  4. public static void main(String[] args){
  5.  
  6. Random randomGenerator = new Random();
  7. int count = 0;
  8. do{
  9. int randomInt = randomGenerator.nextInt(101);
  10. System.out.println("Random number generated: "+randomInt);
  11.  
  12. if(randomInt%2 == 0){ //randomInt is even
  13. for(int i = 0; i < randomInt; i++){
  14. System.out.print("*");
  15. }
  16. System.out.println();
  17. }
  18. else{//randomInt is odd
  19. for(int i = 0; i < randomInt; i++){
  20. System.out.print("&");
  21. }
  22. System.out.println();
  23. }
  24.  
  25.  
  26.  
  27. count++;
  28. }while(count < 3);
  29.  
  30.  
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement