Number of chocolates left after k iterations | C ++ program to find remaining chocolates after k iterations ; Function to find the chocolates left ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int results ( int n , int k ) { return round ( pow ( n , ( 1.0 / pow ( 2 , k ) ) ) ) ; } int main ( ) { int k = 3 , n = 100000000 ; cout << " Chocolates ▁ left ▁ after ▁ " << k << " ▁ iterations ▁ are ▁ " << results ( n , k ) ; return 0 ; }