C Program To Compute Quotient and Remainder: In this program, we will learn how to find the quotient and remainder of any integer.
In this program we use:
- Data Types
 - Variables, Constants, and Literals
 - Input-Output (I/O)
 - Programming Operators
 
Working:
In this program, we collect the input from the user and the data is stored as Dividend and Divisor respectively.
Then, the Quotient is evaluated by using the divisor operator (/) and stored.
Similarly, the Remainder is evaluated by using the modulo operator (%) and stored.
Source Code:
#include <stdio.h>
int main() 
{
    int dividend, divisor, quotient, remainder;
    printf("Enter dividend: ");
    scanf("%d", ÷nd);
    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: 16
Enter divisor: 5
Quotient = 3
Remainder = 1 
Feel free to ask any queries.
Liked the content then share it with your fellow mates.

No comments:
Post a Comment