program to get the remainder and quotant of given two
numbers with out using % and / operators?
Answer Posted / venkat raj
#include<stdio.h>
#include<conio.h>
int remainder;
void main()
{
int dividend, divisor;
int quotient;
int division(int,int);
printf("Enter the value of Dividend and Divisor\n");
scanf("%d %d",÷nd,&divisor);
quotient = division(dividend,divisor);
printf("The Quotient is %d\n",quotient);
printf("The Remainder is %d\n",remainder);
}
int division(int dividend,int divisor)
{
int quotient=0,tempdivisor = divisor;
if(dividend == divisor)
{
remainder=0;
return 1;
}
else if (dividend < divisor)
{
remainder=1;
return 0;
}
while(tempdivisor <= dividend)
{
tempdivisor = tempdivisor + divisor;
quotient = quotient++;
}
remainder=dividend-(tempdivisor-divisor);
return quotient;
}
| Is This Answer Correct ? | 18 Yes | 6 No |
Post New Answer View All Answers
Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?
What does the && operator do in a program code?
hi send me sample aptitude papers of cts?
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
What are the types of variables in c?
What is the function of multilevel pointer in c?
What do you mean by invalid pointer arithmetic?
What does *p++ do? What does it point to?
Define macros.
What are the different categories of functions in c?
Is c call by value?
What are the advantages of using linked list for tree construction?
Can math operations be performed on a void pointer?
Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.