PPS Practical 51

PPS Practical 51
  • Aim: Define structure data type called time_struct containing three member's integer hour, integer minute and integer second. Develop a program that would assign values to the individual number and display the time in the following format: 16: 40:51.
  • Code:
    //For turbo C++ remove below comments
    #include <stdio.h>
    //#include<conio.h>
    struct time_struct
    {
        int hour;
        int minute;
        int second;
    }time;
    void main()
    {
        // clrscr();
        printf("Enter Hour : ");
        scanf("%d",&time.hour);
        printf("Enter Minute : ");
        scanf("%d",&time.minute);
        printf("Enter Second : ");
        scanf("%d",&time.second);
        printf("\nTime= %d:%d:%d",time.hour,time.minute,time.second);
        // getch();
    }
    
  • Output:
    Output of practical 51

Comments