Wednesday, 12 May 2021

Write a C program to print your name, date of birth and mobile number.

Write a C program to print your name, date of birth and mobile number.






#include 
#include 

int main()
{

    char name[20];
    int dd, mm, yy;
    long double mob;

    printf("Enter your name: ");
    scanf("%[^\n]%*c", &name);
A1:
    printf("\nEnter Your Dath Of Birth in dd/mm/yy format :");
    scanf("%d/%d/%d", &dd, &mm, &yy);

    if (dd > 31 || mm > 12 || yy > 2021 || yy < 1900)
    {
        printf("*enter correct date*");
        goto A1;
    }

    printf("Enter Your Mobile Number :+91 ");
    scanf("%lf", &mob);

    printf("\nName :   %s", name);
    printf("\nD.O.B :  %02d/%02d/%04d", dd, mm, yy);
    printf("\nMobile number : %.0lf", mob);
}

Output:





Share:

Related Posts:

0 comments:

Post a Comment