In the number scanf()
part of this code, if I enter input 01234567 , the printf()
function prints 1234567 and it does not print the 0 . What to do to solve the problem?
#include<stdio.h>
int main()
{
long int number , date , month , year ;
char name[50];
printf("Enter name \n");
gets(name);
printf("Enter mobile number\n");
scanf("%ld",&number);
printf("Enter date of birth(date)\n");
scanf("%ld",&date);
printf("Enter date of birth(month)\n");
scanf("%ld",&month);
printf("Enter date of birth(year)\n");
scanf("%ld",&year);
///printing starts
printf("Name: %s\n",name);
printf("Number: %ld\n",number);
printf("DOB: %ld/%ld/%ld",date,month,year);
return 0;
}
for the number part , this code shows the output : 1234567 but input was 01234567
Expected output : 01234567