Search
 
SCRIPT & CODE EXAMPLE
 

C

how to modulo in c without use the operator

#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 :: matrix multiplication in c 
C :: c string 
C :: dynamic memory in c 
C :: c pass int by reference 
C :: accessing elements of 1d array using pointers 
C :: c char to lower case 
C :: strcasecmp c 
C :: c check if array is empty 
C :: c substring 
C :: how to print in c 
C :: c program to find the frequency of all characters in a string 
C :: check if string is the same c 
C :: c functions example 
C :: how to add 1 to 10 in c 
C :: getchar 
C :: stack push 
C :: read file c 
C :: mongodb read 
C :: pid of a process in c 
C :: empiler une pile on c 
C :: getchar c 
C :: esp32 dhcp server 
C :: compile multiple c files 
C :: how to print logs when doing unit-testing in rust 
C :: what is console in sublime text 
C :: ansi c read write bmp 
C :: c program for calculating product of array 
C :: How to include multiline conditional inside template literal 
C :: solidity signature r s v 
C :: error: ‘_Atomic’ does not name a type 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =