how to write optimum code to divide a 50 digit number with a
25 digit number??



how to write optimum code to divide a 50 digit number with a 25 digit number??..

Answer / Nidhi Rajput

In C, you can use long long integers to handle large numbers. Here's an example of how you can divide two large numbers:

```c
#include <stdio.h>

long long int div(long long int a, long long int b) {
long long int quotient = 0;
long long int temp = a;
while (temp >= b) {
temp -= b;
quotient++;
}
return quotient;
}

int main() {
long long int num1 = 123456789012345678901234567890;
long long int num2 = 12345678901234567;
printf("The quotient is: %lld", div(num1, num2));
return 0;
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

write a program in c to find out the sum of digits of a number.but here is a condition that compiler sums the value from left to right....not right to left..

1 Answers  


i=10,j=20 j=i,j?(i,j)?i:j:j print i,j

1 Answers   CSC,


What are the rules for identifiers in c?

1 Answers  


What is c programing language?

1 Answers  


WAP to accept rollno,course name & marks of a student & display grade if total marks is above 200?

4 Answers  


What language is c written?

1 Answers  


write a program to display reverse of a number using for loop?

14 Answers  


how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ?

0 Answers  


explain what is fifo?

1 Answers  


simple program of graphics and their output display

1 Answers   Elysium,


Why static variable is used in c?

1 Answers  


why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above

1 Answers  


Categories