Facebook
From Toxic Tern, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 264
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <cstdlib>
  4. #include <cstdio>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {  string PESEL;
  10.     int suma;
  11.     cin>>PESEL;
  12.     int i[11];
  13.     for(int j=0;j<12;j++)
  14.     {
  15.         i[j]=PESEL[j] - '0';
  16.     }
  17.     suma=i[0]*1+i[1]*3+i[2]*7+i[3]*9+i[4]*1+i[5]*3+i[6]*7+i[7]*9+i[8]*1+i[9]*3+i[10]*1;
  18.  
  19.     if(suma>0)
  20.     {
  21.         if(suma%10==0 ) cout<<"D";
  22.         else cout<<"N";
  23.     }
  24.     else
  25.         cout<<"Niepoprawny PESEL";
  26.  
  27.  
  28.  
  29.     return 0;
  30. }