Sorry for the bothering.
I did the function desired.
Code:
#include <stdio.h>
#include <memory.h>
//#define LoS 5;
int main(void){
unsigned int n=0,*S[n],i,j;
unsigned int* TS=NULL;
int LoS_temp=5;
int LoS[n];
//char format[3*(LoS-1)];
//format = "%d %d %d %d";
//format = "I Love You";
/*
for(i=0;i<LoS;i++){
format[3*i] = '%';
format[3*i+1] = 'd';
if((3*i+2) != (3*(LoS-1)))
format[3*i+2] = ' ';
else
format[3*i+2] = 0;
}
*/
while(scanf("%d",&n) != EOF){
printf("You are going to input %d sequence(s).",n);
printf("\n");
/* 動態配置陣列記憶體空間 */
for(i=0;i<n;i++){
printf("Please enter the number of element in sequence NO.%d :",i+1);
scanf("%d",&LoS_temp);
LoS[i] = LoS_temp;
S[i] = (int*)malloc(LoS[i]*sizeof(int));
printf("You have %d elements in sequence NO.%d.",LoS[i]-1,i+1);
printf("\n");
}
printf("Memory allocation success!");
printf("\n");
/* 動態配置陣列記憶體空間 */
for(i=0;i<n;i++){
printf("Please enter the element(s) of squence %d",i+1);
printf("\n");
for(j=0;j<LoS[i]-1;j++){
scanf("%d",&S[i][j]);
//getchar();
}
}
for(i=0;i<n;i++){
if((S[i][1]-S[i][0])==(S[i][2]-S[i][1])){
S[i][LoS[i]-1] = S[i][LoS[i]-2]+(S[i][1]-S[i][0]);
for(j=0;j<LoS[i];j++) printf("%d ",S[i][j]);
}
else{
S[i][LoS[i]-1] = S[i][LoS[i]-2]*(S[i][1]/S[i][0]);
for(j=0;j<LoS[i];j++) printf("%d ",S[i][j]);
}
printf("\n");
}
}
getchar();
return 0;
}