Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import java.lang.Math;
- public class Solution{
- public static void main(String args[]) {
- Scanner sc = new Scanner(System.in);
- int i = sc.nextInt();
- int isPrime = 1;
- int j = 2;
- while(j<= Math.sqrt(i)){
- if(i%j==0){
- isPrime=0;
- break;
- }
- j++;
- }
- if(isPrime==0 && i != 2){
- for(int temp=0; temp<i; temp++){
- System.out.println("Hello codesprint");
- }
- }
- else{
- for(int temp=0; temp<i; temp++){
- System.out.println("Hello World");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment