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

前端 未结 6 1834
梦毁少年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:16

    there are some syntax errors to your program heres a working code;

    #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;
    }
    

    }

提交回复
热议问题