倒数第七行为什么要乘以8?time=size_file*8/velocity; //注意1字节等于8位

5.编写一个程序,提示用户输入以兆位每秒(Mb/s)为单位的下载速度和以兆字节(MB)为单位的文件大小。程序中应计算文件的下载时间。注意,这里1字节等于8位。使用float类型,并用/作除号。该程序要以下面的格式打印3个变量的值(下载速度,文件大小和下载时间),显示小数点后面两位数字:

At 18.12 megabits per second, a file of 2.20 megabytes downloads in 0.97 seconds.

#include<stdio.h>
int main(void)
{
float velocity, size_file, time; //下载速度、文件大小、时间
printf("请输入下载速度(Mb/s)、文件大小(MB):\n");
scanf("%f %f",&velocity,&size_file);
**time=size_file8/velocity; //注意1字节等于8位***
printf("At %.2f megabits per second, a file of %.2f megabytes\ndownloads in %.2f seconds.",velocity, size_file, time);
return 0;
}

size_file是指字节数,每个字节是8bit(位),算位数就要X8.