Compute Quotient and Remainder

Write a program to calculate Compute Quotient and Remainder.

C Program

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

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

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

    quotient = divident / divisor;
    remainder = divident % divisor;

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

    return 0;
}

Example:

Enter divident value : 22
Enter divisor value : 7

Example:

Quotient is 3
Remainder is 1


No comments:

Post a Comment