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 128 views
1 answer 124 views
1 answer 161 views
161 views asked Mar 3, 2022 by avibootz
1 answer 141 views
1 answer 130 views
1 answer 130 views
...