Java Interface
Submissions: 836   Accuracy:

32.22%

  Difficulty: Basic   Marks: 1

Like a class, an interface can have methods and variables, but the methods declared in interface are by default abstract (only method signature, no body).  

Given an inteface in1 which includes a method display which takes an integer as input .

interface in1
{
    void display(int p);
}

Task is to write a class testClass which implements interface in1 and has a method named display which takes an integer as input and total number of prime numbers between 2 and integer k (including it). Main function in written for you in the editor.

Input: 
The first line will contain an integer (number of test cases). Each test case consists of an integer n.

Output: 
Print total number of prime numbers between 2 and the given number ( including them ).

Constraints: 
1 < = T < = 1000
2<= n <= 104

Example:
Input:

2
13
19

Output:
6
8

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: S_A
Author: saksham0751


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.