Quantcast
Channel: Implement division using only addition - Code Golf Stack Exchange
Viewing all articles
Browse latest Browse all 18

Answer by Parag for Implement division using only addition

$
0
0

C++ ,100201

for(int a = 1; a<=200; a++){            for(int b=1;b<=a;b++){    iter1 = iter2 = b; cout<<a<<""<<b<<endl;   c1 =0;while(iter1 <= a){    iter1 = iter1 + iter2;    c1 ++;    nadd++;}cout<<"Quotient : "<<c1;cout<<" Remainder :"<<a - (iter1 - iter2)<<endl;    }  }cout<<"total of add "<<nadd;

Viewing all articles
Browse latest Browse all 18

Trending Articles