Saturday, August 25, 2018

DT12: Print date/month/Year

  • Problem Description

    Write a C program to print your name, date of birth. and mobile number.
  • CODING ARENA
  • #include <stdio.h>
    int main()
    {
      char name[100],month[100];
      int date,year,phc,ph;
      scanf("%s %s",name,month);
      scanf("%d %d %d %d",&date,&year,&phc,&ph);
      printf("Name:%s\n",name);
      printf("DOB:%s %d %d\n",month,date,year);
      printf("Mobile:%d-%d",phc,ph);

    return 0;
    }
  • Test Case 1

    Input (stdin)
    SRMUniversity
    
    March
    
    23
    
    1991
    
    99
    
    1234567890
    
    
    Expected Output
    Name:SRMUniversity
    
    DOB:March 23 1991
    
    Mobile:99-1234567890
  • Test Case 2

    Input (stdin)
    CMC
    
    January
    
    23
    
    1976
    
    91
    
    1233211234
    
    
    Expected Output
    Name:CMC
    
    DOB:January 23 1976
    
    Mobile:91-1233211234

1 comment: