Guest User

Untitled

a guest
Jan 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.lang.Math;
  3.  
  4. public class Solution{
  5.  
  6. public static void main(String args[]) {
  7. Scanner sc = new Scanner(System.in);
  8. int i = sc.nextInt();
  9. int isPrime = 1;
  10. int j = 2;
  11. while(j<= Math.sqrt(i)){
  12.  
  13. if(i%j==0){
  14. isPrime=0;
  15. break;
  16. }
  17. j++;
  18.  
  19. }
  20. if(isPrime==0 && i != 2){
  21. for(int temp=0; temp<i; temp++){
  22. System.out.println("Hello codesprint");
  23. }
  24. }
  25. else{
  26. for(int temp=0; temp<i; temp++){
  27. System.out.println("Hello World");
  28. }
  29. }
  30.  
  31. }
  32. }
Add Comment
Please, Sign In to add comment