I'm trying to create a program that be able to get the two numbers with a maximum of 1000 digits from the user and then print the result (with C (programming language))
notes to create this program :
1-to get the two numbers, use strings with a length of 1000 characters.(consider a character for the zero in the end of the sring)
2-to store the numbers , use two array with a length of 1000 block (home).each digit of a large numbers must be store in a separate array block.(for example: 365 ( "3" store in a block(home) and 6 store in another block and ...)
3-To get the numbers as strings and convert it to a numeric array, addition, subtraction and printing large numbers, use separate function. the "main" function must be very small.
I wrote this code but can't figure out why it wont work:
/*codes*/
#include <conio.h>
#include <stdio.h>
#define hang 1
void sinascan1(char sina[2],int i){
puts("Enter number 1");
gets(sina);
while (i != hang){
sina[i] -= 48;
printf ("%d\n", sina[i]);
i++;
}
}
void sinascan2(char sina1[2],int i){
puts("Enter number 2");
gets(sina1);
while (i != hang){
sina1[i] -= 48;
printf ("%d\n", sina1[i]);
i++;
}
}
void sinajam(char sina[2],char sina1[2],char jam[3],int i){
puts("____");
int f,g;
while (i != hang){
jam[i]=sina[i]+sina1[i];
printf ("%d\n", jam[i]);
i++;
}
}
int main()
{ int i=0;
char sina[2],sina1[2];
char jam[2];
sinascan1(sina,i);
sinascan2(sina1,i);
sinajam(sina,sina1,jam,i);
getch();
return 0;
}
how can I do that?