C Program to Find Quotient and Remainder of Two Integers Entered by User

Source Code


/* C Program to compute remainder and quotient  */

#include <stdio.h>
int main(){
    int dividend, divisor, quotient, remainder;
    printf("Enter dividend: ");
    scanf("%d",&dividend);
    printf("Enter divisor: ");
    scanf("%d",&divisor);
    quotient=dividend/divisor;           /*  Computes quotient */
    remainder=dividend%divisor;          /* Computes remainder */
    printf("Quotient = %d\n",quotient);
    printf("Remainder = %d",remainder);
    return 0;
}
Output
Enter dividend: 25
Enter divisor: 4
Quotient = 6
Remainder = 1

No comments

Powered by Blogger.