TCS
Company
Programming
Program
Write a C program to print Date ?
Read Solution (Total 10)
-
- #include
#include
#include
int main()
{
struct date d;
getdate(&d);
printf("Current system date is %d/%d/%d",d.da_day,d.da_mon,d.da_year);
getch();
return 0;
}
Note:1.This c program prints current system date. To print date we will use getdate function.
2.This code works in Turbo C only because it supports dos.h header file. - 10 years agoHelpfull: Yes(22) No(1)
- #include
#include
#include
void main()
{
struct date d;
clrscr();
getdate(&d);
printf("%d",sizeof(d));
printf("nThe current date is %d/%d/%d",d.da_day,d.da_mon,d.da_year);
getch();
}
Date With time
#include
#include
int main(void)
{
time_t m;
clrscr();
m=time(NULL);
printf(ctime(&m));
getch();
}
- 10 years agoHelpfull: Yes(6) No(4)
- #
#
struct date
{
int day;
int month;
int year;
}dateref;
void setDateMonthYear(int daytext,int monthtext,int yeartext)
{
dateref.day= daytext;
dateref.month= monthtext;
dateref.year= yeartext;
}
void printDateMonthYear()
{
printf("date is %d month is %d year is %d",dateref.day,dateref.month,dateref.year);
}
void main()
{
int datetext,monthtext,yeartext,
printf("enter date");
scanf("%d",&datetext);
printf("enter month");
scanf("%d",&monthtext);
printf("enter year");
scanf("%d",&yeartext);
setDateMonthYear(daytext,monthtext,yeartext);
printDateMonthYear();
getch();
} - 10 years agoHelpfull: Yes(3) No(0)
- Can any one please tell the programm for
Sum of odd no. between N1=7 and N2=24 excluding N1 and N2. i/p take from user by uaing scanf and don't use getch(). This question asked by tcs this year in programming section - 7 years agoHelpfull: Yes(1) No(0)
- what is the out put of following program plz
x=0;y=1;
for(j=1;j - 10 years agoHelpfull: Yes(0) No(1)
- void main()
{
int a,b,c;
scanf("%d,%d,%d,&a,&b,&c")
printf("%d,%d,%d" a,b,c); - 9 years agoHelpfull: Yes(0) No(1)
- #include
#include
#include
int main()
{
struct date d;
getdate(&d);
printf("Current system date is %d/%d/%d",d.da_day,d.da_mon,d.da_year);
getch();
return 0;
} - 9 years agoHelpfull: Yes(0) No(0)
- #include
main()
{
int date,month,year;
date=05;
month=6;
year=2015;
printf("%d%d%d",date,month,year);
} - 9 years agoHelpfull: Yes(0) No(2)
- void main()
{
time_t t;
time(&t);
printf("date and time is:%s",ctime(&t));
} - 7 years agoHelpfull: Yes(0) No(0)
- #include
#include
#include
int main()
{
struct date d;
getdate(&d);
printf("current system date is %d%d%d",d.da_day,d.day_mon,d.da_year);
getch();
return(0);
} - 6 years agoHelpfull: Yes(0) No(0)
TCS Other Question