Error is coming

#include
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int div(int a,int b){
while(a%b==0){
a=a/b;
}
return a;
}

int isUgly(int no){
no=div(no,2);
no=div(no,3);
no=div(no,5);
return (no == 1) ? 1 : 0;
}

int ans(int n){
int i=1;
int c=1;
while(c<n){
i++;
if(isUgly(i)){
c++;
}
}
return i;
}

int main() {
int t;
cin>>t;
while(t–){
int n;
cin>>n;
cout<<ans(n)<<endl;

}
return 0;

}

hello @mansi25

pls share ur code using cb ide

change ur div function name to something else.
becuase div is predefined function in c++.

also brute force approach will give tle.
try different approach

still error is coming

check now->


just changed the function name

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.