Skip to content

Instantly share code, notes, and snippets.

@w495
Created December 16, 2013 10:12
Show Gist options
  • Save w495/7984829 to your computer and use it in GitHub Desktop.
Save w495/7984829 to your computer and use it in GitHub Desktop.
Умножение через сложение и сдвиг. Автор: студент первого курса Даниил Губарев.
#include <stdio.h>
int main(){
unsigned long a, b, c = 0, i = 0;
scanf("%lu%lu", &a, &b);
while (b != 0){
if (b & 1)
c += a << i;
i++;
b >>= 1;
}
printf("%lu", c);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment