U2p5.java

import java.util.*; public class u2p5 { public static void main(String args[]) { int j; int arr[]=new int[10]; Scanner sc=new Scanner(System.in); System.out.println("Enter a 10 values"); for(int i=0;i<10;i++) { arr[i]=sc.nextInt(); } System.out.println("Prime numbers"); for(int i=0;i<10;i++) { for(j=2;j<=arr[i]-1;j++) { if(arr[i]%j==0) break; } if(j==arr[i]) { System.out.println(arr[i]); } } } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.