Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int podzielnosc13 (string liczba)
  6. {
  7. int suma=0;
  8. int n=liczba.size();
  9. int r[]={1,10,9,12,3,4};
  10. for(int i=n-1;i>=0;i--)
  11. {
  12. suma+=(liczba[i]-'0')*r[(6-((i+1)%6))];
  13. }
  14. return suma%13;
  15. }
  16.  
  17. int main()
  18. {
  19. cout<<podzielnosc13("1300000000000000000000000000000000000000012");
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement