83. Kiểm tra hai số có cùng dấu ?

PHOTO EMBED

Tue Aug 24 2021 13:00:30 GMT+0000 (Coordinated Universal Time)

Saved by @_Ryan_ #html

#include<stdio.h>


float check_number(float num1, float num2)
{
    int answer;
    if(num1 >= 0 && num2 >= 0)
    {
        answer = 1;
    }
    else
    {
        answer = 0;
    }
    return answer;
}
void main()
{
    float num1, num2, answer;
    printf("enter number 1: ");
    scanf("%f", &num1);
    printf("enter number 2: ");
    scanf("%f", &num2);

    answer = check_number(num1, num2);

    if(answer == 1)
    {
        printf("two number the same sign");
    }
    else
    {
        printf("two number different sign");
    }

}
content_copyCOPY