question:
find the index 7 binary of given input.
input: 100
output:202
Solution
#include <iostream> 
#include<algorithm>
using namespace std; 
int main(){
    int n;
    cin >> n;
    bool neg =false;
    if(n<0){
        neg = true;
        n=abs(n);
    }
    string s=" ";
    while(n>0){
        int rem=n%7;
        s.append(to_string(rem));
        n=n/7;
    }
    if(neg){
        s.append("-");
        reverse(s.begin(),s.end());
    }
   cout<<s;
    return 0;
}
}
