C Program To Make Age Calculator Application
Learn How To Make Age Calculator Application in C Programming Language. This C Program To Find Present Age of a Person takes in the Current Date and the Birth Date as Inputs from the User. It is a simple Program To Calculate Current Age of a Person by using Addition and Subtraction Operators. This C Program will calculate the age in Years, Months and Days.
Must Read: C Program To Run Live Digital Clock
C Program To Find Age of a Person
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #include<stdio.h> #include<stdlib.h> int current_date, birth_date, calculated_date, current_month, birth_month, calculated_month, current_year, birth_year, calculated_year; void year(int current_date, int current_month, int current_year, int birth_date, int birth_month, int birth_year) { if(birth_date > current_date) { current_month = current_month - 1; current_date = current_date + 30; } if(birth_month > current_month) { current_year = current_year - 1; current_month = current_month + 12; } if(birth_year > current_year) { exit(0); } calculated_date = current_date - birth_date; calculated_month = current_month - birth_month; calculated_year = current_year - birth_year; printf("\nPresent Age\nYears: %d\tMonths: %d\tDays: %d\n",calculated_year, calculated_month, calculated_date); } int main() { printf("\nEnter Current Date Details (In Numerical Figures)\n"); printf("Enter Today's Date:\t"); scanf("%d", ¤t_date); printf("Enter Current Month:\t"); scanf("%d", ¤t_month); printf("Enter Current Year:\t"); scanf("%d", ¤t_year); printf("\nEnter Your Birth Details (In Numerical Figures)\n"); printf("Enter Day:\t"); scanf("%d", &birth_date); printf("Enter Month:\t"); scanf("%d", &birth_month); printf("Enter Year:\t"); scanf("%d", &birth_year); year(current_date, current_month, current_year, birth_date, birth_month, birth_year); return 0; } |
Must Read: C Program To Print Map of India
Output

If you have any compilation errors or doubts in this C Program To Make Age Calculator Application, let us know about it in the Comment Section below.
Thank you so much. I was waiting for these kinds of programs.
Happy that you liked the C Program to calculate age of a person.
आपका बहुत शुकृर्या। एेसे सी पृरोग्रआम की बहुत जरूरत थी।
Is it possible to find the difference in birth time along with the date of birth calculator in c program?
Logic behind if statements…..
I have a function’print’should have prototype error how I get solve from this problem please tell fast its urgent
I think this logic does not work properly . if I input current date 20 20 2020 and birth date 10 10 1991 this can calculate.