ProAnswers.org

Write a C program to create the user defined data type hours on int data type and use it in the program ?

#include

#include 

#define H 60 

void main() 

{ 

typedef int hours; 

hours hrs; 

clrscr(); 

printf(“Enter hours:”); 

scanf(“%d”, &hrs); 

printf(“

Minutes: %d”,hrs*H);

printf(“

Seconds: %d”,hrsHH);

getch(); 

} 

Output: 

Enter hours: 2 

Minutes: 120 

Seconds: 7200