printing the integral part of a floating point number

后端 未结 7 544
不知归路
不知归路 2021-01-13 23:03

I am trying to figure out how to print floating point numbers without using library functions. Printing the decimal part of a floating point number turned out to be quite ea

7条回答
  •  青春惊慌失措
    2021-01-13 23:36

    This program will work for you.

    #include
    int main()
    {
        float num;
        int z;
        scanf("%f",&num);
        z=(int)num;
        printf("the integral part of the floating point number is %d",z);
    }
    

提交回复
热议问题