How to convert days to milliseconds in C

1 Answer

0 votes
#include <stdio.h>
  
int daysToMilliseconds(int days) {
    return days * 24 * 60 * 60 * 1000;
}
  
int main(void) {
    printf("%d\n", daysToMilliseconds(1)); 
    printf("%d\n", daysToMilliseconds(2)); 
    printf("%d", daysToMilliseconds(13)); 
}
  
  
    
    
    
    
/*
run:
    
86400000
172800000
1123200000
    
*/

 



answered Mar 3, 2022 by avibootz

Related questions

1 answer 210 views
1 answer 200 views
1 answer 225 views
225 views asked Mar 3, 2022 by avibootz
1 answer 216 views
1 answer 199 views
1 answer 205 views
...