• c语言中浮点数的声明与输出


    c语言中浮点数的声明与输出。

    [root@centos79 test]# cat test2.c
    #include <stdio.h>
    
    int main(void)
    {
            float f = 1000.0;
            double d = 1000.0;
            long double ld = 1000.0;
    
            printf("float: %f.
    ", f);
            printf("float: %e.
    
    ", f);
    
            printf("double: %f.
    ", d);
            printf("double: %e.
    
    ", d);
    
            printf("long double: %Lf.
    ", ld);
            printf("long double: %lf.
    ", ld);
            printf("long double: %le.
    ", ld);
    
            return 0;
    }
    [root@centos79 test]# gcc test2.c && ./a.out
    float: 1000.000000.
    float: 1.000000e+03.
    
    double: 1000.000000.
    double: 1.000000e+03.
    
    long double: 1000.000000.
    long double: 1000.000000.
    long double: 1.000000e+03.
  • 相关阅读:
    Java-判断一个数是不是素数
    Sublime快捷键
    python
    全排列
    python
    python
    OpenCV 实现图像结构相似度算法 (SSIM 算法)
    C++
    C++
    NFA 转 DFA
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/15063696.html
Copyright © 2020-2023  润新知