Câu 2:
#include <bits/stdc++.h>
using namespace std;
signed main()
{
long long n, a;
cin>>n>>a;
long long dem=0;
for(int i=1; i<=n; i++)
{
if(i%a==0) dem++;
}
cout<<dem;
}
Câu 1:
#include <bits/stdc++.h>
using namespace std;
signed main()
{
long long n, a;
cin>>n>>a;
long long dem=0;
for(int i=1; i<=n; i++)
{
if(i%a==0) cout<<i<<' '
}
}
Câu 3:
#include <bits/stdc++.h>
using namespace std;
signed main()
{
long long n, a;
cin>>n>>a;
long long dem=0;
long long sh=0;
for(int i=1; i<=n; i++)
{
if(i%a==0) dem++, sh+=i;
}
if(sh==0) {cout<<0; return 0;}
else cout<<(long double) sh/dem;
}