Is Timetaken equation correct?

I am beginner of C language, and i made this small script to find Download Time Required for Downloading file at given speed.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  
#include <stdio.h>

  int main(void)
  {
  float dspeed;
  float filesize;
  float timetaken;
  float hours;
  float minutes;
  
  printf("\nHow Much is Your Internet Speed (In Mbits): ");
  scanf("%f",&dspeed);  
  printf("How Much is File Size(In MBs):");
  scanf("%f",&filesize);
  timetaken = (1024*1024*filesize)/(1024*1024*(dspeed/8));
  hours = timetaken/3600;
  minutes = timetaken/60;
  printf("\nAt %2.2f Mbps, a File of %2.2f Megabytes will take %2.2f seconds or " 
  "%2.2fhrs or %2.2fminutes",dspeed,filesize,timetaken,hours,minutes);
    getch();
    return 0;
}


how to make Output that shows time HH:MM:Ss
Last edited on
Topic archived. No new replies allowed.