且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查如果c中有一个被零除

更新时间:2023-11-27 13:19:28

 #包括LT&;&stdio.h中GT;
void函数(INT);诠释的main()
{
     INT X;     的printf(请输入X:);
     scanf函数(%d个,&安培; X);功能(X);返回0;
}void函数(INT X)
{
    浮动外汇;    如果(X == 0)//简单!
        的printf(被零除是不允许的);
    其他
        FX = 10 / X;
        输出(F(X)是:%.5f,FX);}

#include<stdio.h>
void function(int);

int main()
{
     int x;

     printf("Enter x:");
     scanf("%d", &x);

function(x);

return 0;
}

void function(int x)
{
    float fx;

    fx=10/x;

    if(10 is divided by zero)// I dont know what to put here please help
        printf("division by zero is not allowed");
    else
        printf("f(x) is: %.5f",fx);

}

#include<stdio.h>
void function(int);

int main()
{
     int x;

     printf("Enter x:");
     scanf("%d", &x);

function(x);

return 0;
}

void function(int x)
{
    float fx;

    if(x==0) // Simple!
        printf("division by zero is not allowed");
    else
        fx=10/x;            
        printf("f(x) is: %.5f",fx);

}