Program to create
user-defined data type hours on int data type and use it in the program.
#define H 60
main ()
{
typedef int hours; //
New type hours is defined
hours hrs; // A variable hrs whose type is
hours
// hrs is a variable of
type ‘hours’. It can be processed like an int variable
printf(“Enter Hours:”);
scanf(“%d”,&hrs);
printf(“\n Minutes = %d”, hrs*H);
printf(“\n Seconds = %d”, hrs*H*H);
}
OUTPUT:
Enter Hours: 2
Minutes = 120
Seconds = 7200