fork download
  1. #include<stdio.h>
  2. #include <string.h>
  3. int main()
  4. {
  5. char date[20];
  6. char day[3];
  7. char month[4];
  8. char year[5];
  9. char day_month [7];
  10. printf("Please enter your date: ");
  11. gets (day);
  12. printf("Enter your month: ");
  13. gets (month);
  14. printf("Please enter your year: ");
  15. gets(year);
  16.  
  17. strcpy( day_month,day );
  18. strcat( day_month,"/" );
  19. strcat( day_month,month);
  20. strcpy( date,day_month );
  21. strcat( date,"/" );
  22. strcat( date,year);
  23. printf("\nYour date is %s ",date);
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 1724KB
stdin
21
12
2012
stdout
Please enter your date: Enter your month: Please enter your year: 
Your date is 21/12/2012