answersLogoWhite

0


Best Answer

//program to find the age of given date of birth

#include <dos.h>

#include <stdio.h>

int main(void)

{

struct date d;

int bd,bm,by,day,m,y,cd,cm,cy;

clrscr();

getdate(&d);

printf("\t**********WELCOME TO AGE FINDER PLACE************\n");

printf("\t*************************************************\n\n");

cd=d.da_day;

cm=d.da_mon;

cy=d.da_year;

printf("Enter the birthe date : ");

scanf("d%d",&bd,&bm,&by);

{

if(cd<bd)

{

cm=cm-1;

cd=cd+30;

day=cd-bd;

}else

day=d.da_day-bd;

}

{

if(cm<bm)

{

cy=cy-1;

cm=cm+12;

m=cm-bm;

}else

m=d.da_mon-bm;

}

y=cy-by;

printf("your age is:-\n");

printf("year=%d\tmonth=%d\tday=%d\n",y,m,day);

getch();

}

//by DILKASH

from MANUU

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

9y ago

//program to find the age of given date of birth

//program to find the age of given date of birth

#include <dos.h>

#include <stdio.h>

int main(void)

{

struct date d;

int bd,bm,by,day,m,y,cd,cm,cy;

char ch;

clrscr();

do

{

getdate(&d);

printf("\t**********WELCOME TO AGE FINDER PLACE************\n");

printf("\t*************************************************\n\n");

cd=d.da_day;

cm=d.da_mon;

cy=d.da_year;

printf("Enter the birthe date :(DD MM YYYY ");

scanf("%d%d%d",&bd,&bm,&by);

{

if(cd<bd)

{

cm=cm-1;

cd=cd+30;

day=cd-bd;

}else

day=d.da_day-bd;

}

{

if(cm<bm)

{

cy=cy-1;

cm=cm+12;

m=cm-bm;

}else

m=d.da_mon-bm;

}

y=cy-by;

printf("your age is:-\n");

printf("year=%d\tmonth=%d\tday=%d\n",y,m,day);

printf("Do you want to continue: ");

scanf("%s",&ch); clrscr();

}

while(ch=='y');

getch();

}

by DILKASH From MANUU

mob:- 9241629586

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

#include<stdio.h>

#include<conio.h>

void main()

{

long int a,age;

clrscr();

printf("Enter your age :");

scanf("%ld",&age);

if(age<=0)

printf("Enter valid data only\n");

else

{

a=(age*365*24*60*60);

printf("Before conversion:\n");

printf("\tAge in years is: %ld\n",age);

printf("After conversion:\n");

printf("\tAge in seconds is: %ld\n",a);

}

getch();

}

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

HERE IS A PROGRAMME THAT WRITTEN BY "ARJUN BHARASAGAR". BY HELP OF THIS PROGRAMME YOU CAN KNOW YOUR CURRENT AGE.

IF YOU WANT TO LEARN MORE ABOUT ANY DOUT IN C OR C++. PLESE MAKE FREINRSHIP BY ORKUT FREE SO THAT I WILL MAIL OR SAY YOU AS I KNOW.

I WILL SAY YOU THE PROCESS OF THIS C PROGRAMME.

# include<stdio.h>

# include<conio.h>

void main()

{

int bd,bm,by,cd,cm,cy,ad,am,ay;

clrscr();

printf("\n\t enter the current date :");

scanf("%d%d%d",&cd,&cm,&cy);

printf("\n\t enter the date of birth : ");

scanf("%d%d%d",&bd,&bm,&by);

if(cd<bd)

{

cm=cm-1;

cd=cd+30;

}

if(cm<bm)

{

cy=cy-1;

cm=cm+12;

}

ad=cd-bd;

am=cm-bm;

ay=cy-by;

printf("\n\t Your age is :%d,%d,%d",ay,am,ad);

getch();

}

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

/*program to calculate the age*/

#include<stdio.h>

#include<conio.h>

int age();

void main()

{

int yr,a;

printf("enter your year of birth\n");

scanf("%d",&yr);

a=age(yr);

printf("\nYour age is %d",a);

}

int age(int yr)

{

int x,y;

printf("enter the current year");

scanf("%d",&x);

y=x-yr;

return (y);

}

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

Reference:cprogramming-bd.com/c_page1.aspx# comparison operator

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a program in c to calculate age?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a program in c to calculate age like from 1977 to 2013?

If you was born in 1977, then you are 35 or 36 years old in 2013 (depending on the current date and your birthday). No computer needed to tell that.


Write a c program for creating a virus?

a c program for creat a virus


Where do we write main function in a c program?

Into the source program.


How do you write a c program to analysis a circuit?

There is no need to write a C program for circuit analysis; there are lots of packages out there that already do that (for example, Spice).


Write a c program to find Volume and surface area of cube?

Write a c program to compute the surface area and volume of a cube


How do you write a C program to check whether the number is odd or even Ps-using DEV complier?

To write a C program to determine if something is odd or even you need to be a programmer. To write a program in C is complicate and only done by programmers.


How do you write socket program in c?

For first find an example program.


How do you write a program in embedded c?

Use a text-editor program.


Write a program in c for checksum?

yes


What is the program to write route cipher?

c#


How do you write a C program to Calculate the Series. The Value of x and n must take from input terminal.?

Reference:cprogramming-bd.com/c_page2.aspx# sum the series


How do you write a c program to calculate income tax using a function?

float income_tax (float income, float tax_percent) { return income * tax_percent / 100; }