Question: Amazon Hackon, Online Assesment Asked Question | Tech Curator | Given Integer N to Zero | 29th September 2023 Question 1
#include<bits/stdc++.h>
using namespace std;
int func(int N){
int i = 2;
while((i * i) < N && (N % i)){
i++;
}
if((i * i) > N){
i = N;
}
return 1 + (N-i)/2;
}
int main(){
int n;
cin>>n;
cout<<func(n);
}
Login before adding your answer.
Question 2: