C语言求助:Dev上可过,洛谷#3WA

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

cedak @ 2020-12-16 19:06:33

代码如下

#include <stdio.h> 

int main(void)
{
    float number;
    int afterDot, intNumber, digit;

    scanf("%f", &number);

    afterDot = ( number - (int)number ) * 10;
    printf("%d.", afterDot);

    intNumber = (int)number;
    while ( intNumber != 0 ) {
        digit = intNumber % 10;
        printf("%d", digit);
        intNumber /= 10;
    }

    return 0;
}

by yuchenren @ 2020-12-16 19:25:09

试试洛谷 IDE

IDE


by yuchenren @ 2020-12-16 19:26:16

重发


by HYdroKomide @ 2020-12-16 19:37:27

直接用字符串翻转它不香吗


by Schwarzkopf_Henkal @ 2020-12-16 19:38:10

@Kevin_FOS C没有标准库函数


by HYdroKomide @ 2020-12-16 19:39:38

哦你用C语言


by HYdroKomide @ 2020-12-16 19:40:07

那么就用char数组代替呗


|