Saturday, May 18, 2019

Write a C Program To Print Date

Write a C program to print current system date. By using get date function.

Program:-

    #include <stdio.h>
    #include <conio.h>
    #include <dos.h>
    
    int main()
    {
       struct date d;
    
       getdate(&d);
    
       printf("Current system date: %d/%d/%d", d.da_day, d.da_mon, d.da_year);
      return 0;

    }

This code works in Turbo C only because it supports dos.h header file.

0 Comments:

Post a Comment