Guest User

pesel

a guest
Jan 27th, 2016
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <stdio.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int pesel[11];
  10. int suma = 0, n=0;
  11.  
  12. //cin >> n;
  13.  
  14. //for (int o = 0; o < n; o++){
  15.  
  16. for (int i = 0; i < 11; i++)
  17. pesel[i] = getchar() - 48;
  18.  
  19. pesel[0] *= 1;
  20. pesel[1] *= 3;
  21. pesel[2] *= 7;
  22. pesel[3] *= 9;
  23. pesel[4] *= 1;
  24. pesel[5] *= 3;
  25. pesel[6] *= 7;
  26. pesel[7] *= 9;
  27. pesel[8] *= 1;
  28. pesel[9] *= 3;
  29. pesel[10] *= 1;
  30.  
  31. for (int i = 0; i < 11; i++)
  32. suma += pesel[i];
  33.  
  34. if (suma > 0)
  35. if ((suma % 10) == 0)
  36. cout << "D" << endl;
  37. else
  38. cout << "N" << endl;
  39. else
  40. cout << "N" << endl;
  41.  
  42. suma = 0;
  43. //}
  44. system("PAUSE");
  45. }
Advertisement
Add Comment
Please, Sign In to add comment