Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a complete C programming to add two very large numbers together as follows

ID: 3644140 • Letter: W

Question

Write a complete C programming to add two very large numbers together as follows:
Enter the first number
1999999999999999999999999999999999999999999996667766999999
Enter the second number
888888888888888888888888888888888888888888888888888888888888888888888888
Sum is
Display the total here

Hint you should use Struct and malloc.

Explanation / Answer

#include #include int main (void) { int i=0,k=0; int tmp1=0, tmp2=0, tmp3=0; char * a; a= (char *) malloc(30 * sizeof(char)); char * b; b= (char *) malloc(30 * sizeof(char)); int * x; x= (int *) malloc(30 * sizeof(int)); int * y; y= (int *) malloc(30 * sizeof(int)); int * z; z= (int *) malloc(61 * sizeof(int)); int * w; w= (int *) malloc(31 * sizeof(int)); int * v; v= (int *) malloc(61 * sizeof(int)); int * solution; solution= (int *) malloc(61 * sizeof(int)); int carry = 0; int c[61]; int d[61]; int f[61]; int g[61]; printf(" Enter a number (up to 30 digits in length)> "); scanf("%s", a); i=0; while(i = 0; i--) { for(k=60; k>=0; k--) { tmp1 = f[i] * g[k]; z[k] = tmp3 + z[k-1]; tmp3 = tmp1 % 10; z[k-1]= tmp1 / 10; } } for(i = 0; i < 61; i++){ printf("%d", z[i]);} printf(" "); return(0); } i added the multiplication part also dont get confused
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote