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

Answer Posted / kadher masthan..,sit

#include <stdio.h>
#include<conio.h>

void main()
{
int a,b,a1,b1,rem=0;
scanf(“%d %d”,&a,&b);


if(a>b)
{
a1=a;
b1=b;
}
else
{
a1=b;
b1=a;
}
while(a1>=b1)
{
rem++;
a1-=b1;
}
printf(" remainder is %d quotient is %d",rem,a1);
}

Is This Answer Correct ?    16 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Compare array data type to pointer data type

603


Where is c used?

653


What is the use of typedef in structure in c?

549


What is difference between Structure and Unions?

644


Explain enumerated types.

602






What do the functions atoi(), itoa() and gcvt() do?

727


what are bit fields in c?

609


What functions are in conio h?

663


What is the purpose of the following code? Is there any problem with the code? void send(int count, short *to, short *from) { /* count > 0 assumed */ register n = (count + 7) / 8; switch (count % 8) { case 0: do { *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n > 0); } }

1962


What is function prototype in c with example?

583


When should a type cast be used?

577


Explain the difference between the local variable and global variable in c?

606


Is there any data type in c with variable size?

636


Is python a c language?

555


Explain what is the benefit of using const for declaring constants?

618