Write a c program to get the system time and date? Solution: #include<stdio.h> #include<time.h> int main()
{ char *date; time_t timer;
timer=time(NULL);
date=asctime(localtime(&timer));
printf("date:%s",date); return;
} Output:
./a.out
date:Fri Nov 19 18:30:21 2010
Write a c program to reverse a line of text (or) reverse a string without using string fucnctions #include<stdio.h> void display(void); int main()
{
printf("Enter the line of text\n" );
display(); return0;
} void display()
{ char c; if((c=getchar())!='\n')
display();
putchar(c); return;
}
sunitha@sunitha-laptop:~/cpgm$ ./a.out
Enter the line of text
Welcome to c World