Skip to content

Commit

Permalink
Main function for Addition of 2 numbers through CLL
Browse files Browse the repository at this point in the history
  • Loading branch information
msindev committed Oct 8, 2018
1 parent b530417 commit b44c92a
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Addition of 2 Large Numbers using Circular Linked List/add-main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "add.h"

int main()
{
char str1[100], str2[100];
int i, num;
struct node *res = NULL;
struct node *first = NULL;
struct node *second = NULL;
first = getnode();
first -> data = 0;
first -> next = first;
second = getnode();
second -> data = 0;
second -> next = second;
printf("Enter number 1: ");
scanf("%s", str1);
printf("Enter number 2: ");
scanf("%s", str2);
for(i = 0; str1[i] != '\0'; i++)
{
num = str[i] - 48;
first = insert(first, num);
}
printlist(first);
for(i = 0; str2 != '\0'; i++)
{
num = str2[i] - 48;
second = insert(second, num);
}
printlist(second);
res = addtolist(first, second);
printlist(res);
return 0;
}

0 comments on commit b44c92a

Please sign in to comment.