Search
 
SCRIPT & CODE EXAMPLE
 

C

how to modulo in c without %

#include<stdio.h>

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

PREVIOUS NEXT
Code Example
C :: CL/cl.h: No such file or directory 
C :: c program to find the factorial of a number 
C :: c modify char array 
C :: initialize array in c with 0 
C :: directory folders structure show windows 10 command prompt 
C :: c int 
C :: read a document in c getting name from console 
C :: c convert char to int 
C :: c get current month, year, day 
C :: c fopen 
C :: C Arithmetic Operators 
C :: c read file content 
C :: How to Convert double to int in C 
C :: volatile keyword in c 
C :: how to use malloc in c 
C :: DrawText() raylib 
C :: c long to string 
C :: mongo connect db 
C :: C strlen implementation 
C :: Initialization of a 3d array in c 
C :: what is type casting in c programming 
C :: print in c 
C :: while loop in c 
C :: majuscule en c 
C :: example of header file in c 
C :: lxde automatic login 
C :: allocating memory for 1Mb text file in C 
C :: C Operator associativity 
C :: convert calendar time to epoch in c programming 
C :: 1 f = c 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =