C Program To Find Quotient And Reminder Of Two Numbers Using If/Else Statements

// C program to find quotient
// and remainder of two numbers
#include <stdio.h>
int main()
{
	int A, B, quotient = 0, remainder = 0;
	// Ask user to enter the two numbers
	printf("Enter two numbers A and B : \n");
	// Read two numbers from the user || A = 17, B = 5
	scanf("%d%d", &A, &B);
	// Calclulate the quotient of A and B using '/' operator
	quotient = A / B;
	// Calclulate the remainder of A and B using '%' operator
	remainder = A % B;
	// Print the result
	printf("Quotient when A/B is: %d\n", quotient);
	printf("Remainder when A/B is: %d", remainder);
	return 0;
}

Output:

Enter two numbers A and B : 17 5
Quotient when A/B is: 3
Remainder when A/B is: 2

Leave a Comment