Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. /*
  2. * test.c
  3. *
  4. * Created on: Dec 10, 2019
  5. * Author: student
  6. */
  7.  
  8.  
  9. // 1770103222698
  10. // 5010124226729
  11.  
  12. #include<stdio.h>
  13. int main(){
  14. char cnp[14];
  15. int AnulNasterii;
  16. int Varsta;
  17. int anCurent;
  18. int zeci;
  19. int unitati;
  20. int cnp1, cnp2;
  21. int numar;
  22.  
  23.  
  24.  
  25.  
  26. printf("Introduceti CNP-ul dumneavoastra: ");
  27. scanf("%s", cnp);
  28. printf("Introduceti anul curent:");
  29. scanf("%d", &anCurent);
  30.  
  31. numar = cnp[0] - '0';
  32. zeci = cnp[1] - '0';
  33. unitati = cnp[2] - '0';
  34.  
  35.  
  36.  
  37. AnulNasterii = 1900 + (numar * 100)+ zeci * 10 + unitati;
  38.  
  39. Varsta = anCurent - AnulNasterii;
  40.  
  41. printf("varsta = %d\n", Varsta);
  42.  
  43.  
  44.  
  45.  
  46. return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement