FAVDICE-Coupon collector problem

I am getting wrong answer for 1st two test cases. please tell me what is wrong in this code

cin>>n;
double ans=0;

    for(double i=1;i<=n;i++)
        ans+=(double)(n/i);
    cout<<fixed<<setprecision(2)<<ans<<endl;

You just need to do this. Maybe you aren’t setting precision or taking double.
Have a look at this implementation code.