想问问C中这个【深基2.例7】数字反转怎么编

P5705 【深基2.例7】数字反转

郭鸿宇AC @ 2020-08-26 20:45:38


#include<stdio.h>
int main()
{
    double number;
    int num;
    double out=0;
    scanf("%lf",&number);
    num=number*10;
    while(num>0){
        out=out*10+num%10;
        num/=10;
    }
     out=out/1000;
     printf("%f",out);
    return 0;
}

by 出言不逊王子 @ 2020-08-26 20:47:20

???


by LucasXu80 @ 2020-08-26 20:47:31

正解是字符串反转(


by chenpengda @ 2020-08-26 20:49:37

建议实在想不出来借鉴题解,但要合理利用题解功能。


by chenpengda @ 2020-08-26 20:49:58

借鉴是指借鉴思路(


|