Wednesday, January 16, 2013

C Language Example # 04 Find Age of the Person by asking their birth year and current year

C Language Example # 04 Find Age of the Person by asking their birth year and current year

Lets find the age difference, Its simple one !


C Language Code:

//Written by Latest Technology Guide   
//Title : Example 04 : Find Age of the Person by asking their birth year and current year.
 

#include <stdio.h>
#include <conio.h>
void main()
{
clrscr();

int dob,cy;

printf("Enter Year of Birth (ex.1985) :");
scanf("%d",&dob);

printf("Enter Current Year            :");
scanf("%d",&cy);

printf("\n Your age is : %d",cy-dob);

getch();
}



Output:

We think there is no need of Output for this program.


--------------------------------------------------------------------------------
Explanation of C Language Example # 04 : Find Age of the Person by asking their birth year and current year

* Enter Current Year and Birth Year..
* Program will calculate the age.
* More function can be added to this program like, date difference, we can check out exact year by using date difference function or manual process. We will provide this program shortly.

Note: All programs are developed and tested using Turbo C++ 3.0 under Windows XP. We just want to provide guidelines to the users. If you are using any other Compiler or other operating system they you need to modify this program as per your requirements. 

1 comment: