C# How to determine if a number is a multiple of another?

前端 未结 6 1831
梦毁少年i
梦毁少年i 2020-12-28 13:50

Without using string manipulation (checking for an occurrence of the . or , character) by casting the product of an int calculation to string.

6条回答
  •  臣服心动
    2020-12-28 14:22

    followings programs will execute,"one number is multiple of another" in

    #include
    int main
    {
    int a,b;
    printf("enter any two number\n");
    scanf("%d%d",&a,&b);
    if (a%b==0)
    printf("this is  multiple number");
    else if (b%a==0);
    printf("this is multiple number");
    else
    printf("this is not multiple number");
    return 0;
    }
    

提交回复
热议问题