why my this code showing time limit exceeded while compiling ??? I run same code on codeblocks and its working perfectly
#include <stdio.h>
int sum(int n)
{
int i=0,total=0;
for( i=1;i<n;i++)
{
if(n%i==0)
{
total=i+total;
}
}
return total;
}
int main()
{
int t,n,z;
scanf("%d",&t);
while(t!=0)
{
scanf("%d",&n);
z = sum(n);
printf(" %d",z);
}
}