Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package q1;
- import java.util.Scanner;
- public class q7 {
- public static void main(String[]args){
- int count=1, a1,a2,flag;
- Scanner keyboard = new Scanner(System.in);
- System.out.println("Enter first number:");
- a1=keyboard.nextInt();
- System.out.println("Enter first number:");
- a2=keyboard.nextInt();
- while(a1<=a2)
- {flag=1;
- for(count=2; count<a1;count++)
- {
- if (a1%count==0)
- {
- flag=0;
- break;
- }
- }
- if(flag==1)
- System.out.println(a1+" ");
- a1++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement