HI
the prgram below request a user to enter 3 character id number and interger age. a function must be used
that tells the user how many years to retirement. i must pass the age and print
a message in the function. retirement age is 65 for persons over 45 and 70 for all
other persons. the id number is a 3 element character array. the program
should continue to accept user input until the id number entered is 000 or age is
-1.
please help. i am fairly new to c and i am unsure of how to do the function part.
my program is compiling and running but a long number is printing and not the age.
#include<stdio.h>
#include<conio.h>
int main ()
{
int idnumber, retirement_years, age=0;
//int current_age (int age1);
do
{
printf ("\nPlease enter 3 digit id number\n");
scanf("%d", &idnumber);
printf("\n Please enter your age\n");
scanf("%d", &age);
if (age >45)
{
retirement_years = 65-age;
printf("\n You have %.2d years to retirement\n", &retirement_years);
}
else
{
retirement_years = 70-age;
printf("\n You have %.2d years to retirement\n", &retirement_years);
}
}
while ((idnumber ==000) || (age== -1));
getch ();
return 0;
}
//int current_age (int age1)