Page 1 of 1

What will be the output of the following C code if the name entered is “TOM” and time taken to enter this name is 2 seco

Posted: Wed Jul 13, 2022 7:56 pm
by answerhappygod
#include <stdio.h>
#include <time.h>
int main ()
{
time_t time1,time2;
char get_input [256];
double dif_sec;
time (&time1);
printf ("Please enter the name of your pet: ");
gets (get_input);
time (&time2);
dif_sec = difftime (time2,time1);
printf ("%.2f\n", dif_sec );
return 0;
}
a) Error
b) 2
c) 2.0
d) 2.00