Hi, I am writing a program to read in two sets of values from the user and store them in seperate arrays. Then combine those two arrays into a third array and display them. I think my logic to do this is correct,maybe not!
Code:
#include <stdio.h>
int main ()
{
int a[10],b[10],c[20];
int k,i,j;
i=0;
printf("Please enter first 10 digits: ");
while (i<10)
{
scanf("%d", &a[i]);
i++;
}
printf("Please enter second 10 digits: ");
k=0;
while (k<10)
{
scanf("c%d",&b[k]);
k++;
}
j=0;
while (j<10)
{
c[j]=a[i];
j++;
}
while (j<20)
{
c[j]=b[k];
j++;
}
j=0;
while(j<20)
{
printf("%d\n", c[j]);
}
return 0;
}