C program to print date

1 Answer(s)

C program to print current system date. To print date, we will use getdate function.

C programming code (Works in Turbo C only)

#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);
getch();
return 0;
}

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

Answered on January 21, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.