in division, we will see the relationship between the dividend, divisor, quotient, and remainder. the number which we divide is called the dividend. the number by which we divide is called the divisor. the result obtained is called the quotient. the number left over is called the remainder.
55 ÷ 9 = 6 and 1dividend divisor quotient remainder
input:dividend = 6divisor = 2output:quotient = 3,remainder = 0
explanationthen, the variables dividend and divisor are divided using the arithmetic operator / to get the quotient as result stored in the variable quotient; and using the arithmetic operator % to get the remainder as result stored in the variable remainder.
example#include <stdio.h>int main() { int dividend, divisor, quotient, remainder; dividend= 2; divisor= 6; // computes quotient quotient = dividend / divisor; // computes remainder remainder = dividend % divisor; printf("quotient = %d
", quotient); printf("remainder = %d", remainder); return 0;}
以上就是计算商和余数的c程序?的详细内容。
