A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Write a C program to find quotient and remainder
Q:

Write a C program to find quotient and remainder

0

C program to find quotient and remainder

How to get quotient and remainder?

Binary operator divide (/) returns the quotient, let suppose if dividend is 10 and divisor is 3, then quotient will be 3.

Binary operator modulus (%) returns the remainder, let suppose if dividend is 10 and divisor is 3, then remainder will be 1.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program to find quotient and remainder in C

#include <stdio.h>

int main()
{
	int dividend, divisor;
	int quotient, remainder;
	
	printf("Enter dividend: ");
	scanf("%d",&dividend);
	printf("Enter divisor: ");
	scanf("%d",&divisor);
	
	quotient= dividend/divisor;
	remainder= dividend%divisor;
	
	printf("quotient: %d, remainder: %d\n",quotient,remainder);
	
	return 0;
}

Output

First run:
Enter dividend: 10
Enter divisor: 3
quotient: 3, remainder: 1 

Second run:
Enter dividend: 10
Enter divisor: 2
quotient: 5, remainder: 0 

Third run:
Enter dividend: 10
Enter divisor: 100
quotient: 0, remainder: 10

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now