0 jvignacio 10 Years Ago Hi guys, just wondering, how would i go about joining numbers together to form one integer.. example.. number 70 54 34 would end up being 705434.. thank u for your ideas... c

0 SpS 34 10 Years Ago Input is always three numbers of two digits or it can be 'n' numbers consisting any number of digits?

0 OPDiscussion Starter jvignacio 10 Years Ago It can be any numbers and as many numbers and digits... like 1 2 3 = 123 or 34 45 56 67 = 34455667 know what i mean ?

0 SpS 34 10 Years Ago It can be any numbers and as many numbers and digits... like 1 2 3 = 123 or 34 45 56 67 = 34455667 know what i mean ? Well then you have to store it in a string. Because there's a limit of integers. Just accept the input as string and merge it.

0 madhuri_mi 10 Years Ago Hi guys, just wondering, how would i go about joining numbers together to form one integer.. example.. number 70 54 34 would end up being 705434.. thank u for your ideas... Hi I have the solution here... Just see is it your required one... Plz reply me back..... #include<stdio.h> int main() { int a[30],i=1,num,cnt=0,num1; printf("Enter the numbers....\n"); printf("If dont want to continue enter 9999\n"); while(1) { scanf("%d",&num); if(num==9999) break; a[i]=num; i++; cnt++; } num1=a[1]; for(i=2; i<=cnt; i++) { if(a[i]<=9) { num1=num1*10; num1=num1+a[i]; } else if(a[i]<=99 && a[i]>10) { num1=num1*100; num1=num1+a[i]; } else if(a[i]<=999 && a[i]>99) { num1=num1*1000; num1=num1+a[i]; } } printf("%d",num1); return 0; }

0 Nick Evan 4,005 10 Years Ago Sorry, but that won't work: It can be any numbers and as many numbers and digits... your program only accepts numbers <=999: else if(a[i]<=999 && a[i]>99) I would go with strings too. Regards Niek

0 dubeyprateek 26 10 Years Ago It can be any numbers and as many numbers and digits... like 1 2 3 = 123 or 34 45 56 67 = 34455667 know what i mean ? What do u think about intiger overflows? int can store maximum of 2,147,483,647.