Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- abstract class A{
- public abstract void special(int n);
- }
- class B extends A{
- public void special(int n){
- int i, j;
- for(i = 1000; i<=n; i++)
- for(j = 1; j<i/2; j++)
- if(j*j == i){
- System.out.println(i+" is a perfect square.");
- break;
- }
- }
- }
- class Squarenos{
- public static void main(String[] args){
- Scanner sc = new Scanner(System.in);
- int n = 0;
- while(n>1000 && n<9999){
- System.out.println("Enter the a number in between 1000 and 9999: ");
- n = sc.nextInt();
- }
- new B().special(n);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement