C Program to Compute Quotient and Remainder

Program to Compute Quotient and Remainder




#include <stdio.h>
int main(){

    int dividend, divisor, quotient, remainder;

    printf("Enter dividend: ");
    scanf("%d", &dividend);

    printf("Enter divisor: ");
    scanf("%d", &divisor);

    // Computes quotient
    quotient = dividend / divisor;

    // Computes remainder
    remainder = dividend % divisor;

    printf("Quotient = %d\n", quotient);
    printf("Remainder = %d", remainder);

    return 0;
}

OutPut


Enter dividend: 25
Enter divisor: 4
Quotient = 6
Remainder = 1

Comments

Popular posts from this blog

C Program to Check Whether a Character is Vowel or Consonant

C Program to Find the Largest Number Among Three Numbers