program to get the remainder and quotant of given two
numbers with out using % and / operators?

Answer Posted / mohammad haris

#include <stdio.h>

int main()
{
int cDivident,cDivisor,cRemainder;

printf("\nEnter Divident and Divisor :\n");
while(!(scanf("%d %d",&cDivident,&cDivisor)))
{
printf("\nPlease Enter Integers!!!:");
fflush(stdin);
}
cRemainder = cDivident;
while ( cRemainder >= cDivisor)
{
cDivident = cDivident - cDivisor;
cRemainder = cDivident;
}

printf("\nReminder = %d",cRemainder);
return 0;
}

Is This Answer Correct ?    10 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

669


Is c easier than java?

578


What is the concatenation operator?

614


A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.

1256


Explain the use of #pragma exit?

701






How can I open a file so that other programs can update it at the same time?

665


What is a structure member in c?

552


What is strcmp in c?

603


How do I read the arrow keys? What about function keys?

618


What is the symbol indicated the c-preprocessor?

700


Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.

2657


Which of the following operators is incorrect and why? ( >=, <=, <>, ==)

672


what is the basis for selection of arrays or pointers as data structure in a program

3790


What are data types in c language?

590


What is scope of variable in c?

573