here is the link
please reply fast
here is the link
please reply fast
Hey @yusuf
just a change
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
int PrimeNo=0;
//for two input
for (int i = 0; i <n;i++) { // mera change
int term = scn.nextInt();
int num = 2;
int LargestPrime = 0;
for (int j = 1; j <= term;) {
int divisor = 2;
Boolean flag = true;
while (divisor < num) {
if (num % divisor == 0) {
flag = false;
}
divisor = divisor + 1;
}
if (flag ==true) {
j++;
PrimeNo = num;
}
//evalution of largest prime
if (LargestPrime < PrimeNo) {
LargestPrime = PrimeNo;
}
num++;
}
System.out.println(LargestPrime);
}
}
}
its gives TLE .
optimize your solution
it is giving tle …what is tle and how to overcome this
i haven’t studied it yet.there is no lecture on that;how can i implement it