My code is giving TLE.Please can anybody help.I am new to programming…
import java.util.;
import java.lang.;
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner kb=new Scanner(System.in);
int n=kb.nextInt();
int i;
int count;
int t;
for(i=0;i<n;i++) {
int no=kb.nextInt();
count=0;
// int t=0;
for(t=1;t<no;t++) {
if(no%t==0) {
count+=t;
}
}
System.out.println(count);
}
kb.close();
}
}
created
last reply
- 10
replies
- 1.1k
views
- 3
users
- 3
links