Last active
April 23, 2022 19:03
-
-
Save sorin-ref/df22d91104a799ea57868cc7a90815ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
const int an_curent = 2022, varsta_maxima = 125; | |
int anul_nasterii, varsta; | |
puts("In ce an te-ai nascut?"); | |
if (scanf("%d", &anul_nasterii) < 1) | |
{ | |
puts("Eroare."); | |
return 1; | |
} | |
if (anul_nasterii < an_curent - varsta_maxima || anul_nasterii > an_curent) | |
{ | |
puts("Eroare."); | |
return 2; | |
} | |
varsta = an_curent - anul_nasterii; | |
printf("Varsta ta este: %d\n", varsta); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment