#include <stdio.h>
#include <math.h>
int main() {
double base = 10; // 设置底数为10
double exponent = -100; // 设置指数为3
while(1)
{
printf("输入V:");
scanf("%lf",&exponent);
printf("为%lfV 或 %lfmV\n",exponent,exponent*1000);
printf("结果为:%lf dB 或 %lf dBm\n", 20*log(exponent)/log(10), 20*log(exponent*1000)/log(10));
}
scanf("%lf",&exponent);
return 0;
}

本文介绍了如何使用C语言编写代码,让用户输入电压值(V/mV),然后计算相应的分贝值(dB)和dBm,通过示例展示了将用户输入的指数转换为dB和dBm的过程。
2418





