Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n,d=0;
  7. char pesel[11];
  8. char wyn[100];
  9. int tab[11];
  10. int w[100];
  11. cin>>n;
  12. do
  13. {
  14. for (int i=0;i<11;i++)
  15. {
  16. cin.clear();
  17. cin>>pesel[i];
  18. }
  19. int g;
  20. int tab[11];
  21. tab[0]=pesel[0]*1;
  22. tab[1]=pesel[1]*3;
  23. tab[2]=pesel[2]*7;
  24. tab[3]=pesel[3]*9;
  25. tab[4]=pesel[4]*1;
  26. tab[5]=pesel[5]*3;
  27. tab[6]=pesel[6]*7;
  28. tab[7]=pesel[7]*9;
  29. tab[8]=pesel[8]*1;
  30. tab[9]=pesel[9]*3;
  31. tab[10]=pesel[10]*1;
  32. for (int b=0;b<11;b++)
  33. {
  34. g+=tab[b];
  35. }
  36. if (g%10==0)
  37. wyn[d]='D';
  38. else wyn[d]='N';
  39. d++;
  40. }
  41. while (d<n);
  42.  
  43. for (int z=0;z<d;z++)
  44. cout<<wyn[z]<<endl;
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement