gpt4 book ai didi

C 程序 - Double 返回零

转载 作者:太空宇宙 更新时间:2023-11-04 05:36:00 24 4
gpt4 key购买 nike

<分区>

这是C程序

#include <stdio.h>
#include <stdlib.h>

int main (void){

double voltage, resistance;
printf("Enter your Voltage: ");
scanf("%f", &voltage);
printf("Enter your Resistance: ");
scanf("%f", &resistance);
double amps = voltage / resistance;
printf("With voltage %f and Ohm %fohms, amps is equal to %f \n", voltage, resistance, amps);
return 0;
}

为什么电压和电阻变量返回值 0.00?

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com