📌  相关文章
📜  如何在没有 % 的情况下在 c 中取模 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:25.535000             🧑  作者: Mango

代码示例1
#include

int main()
{
    //1
    int no,divisor,remainder;
    
    //2
    printf("Enter the number : ");
    scanf("%d",&no);
    
    //3
    printf("Enter the divisor : ");
    scanf("%d",&divisor);
    
    //4
    while(no >= divisor){
        no = no - divisor;
    }
    
    //5
    remainder = no;
    
    //6
    printf("The remainder is %d ",remainder);
    
    return 0;
}