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
What is identifiers in c with examples?
What is methods in c?
How are strings stored in c?
What is the use of c language in real life?
How can I split up a string into whitespace-separated fields?
Explain what is gets() function?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }
Is anything faster than c?
What are the types of arrays in c?
What is the difference between printf and scanf in c?
What are the 4 types of unions?
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); } }
When is a null pointer used?
How do you search data in a data file using random access method?