what do you think about this one?
Code:
:
#include<stdio.h>
#define N 5
#define M 900
void seri(int A[N][M],int x,int y,int n);
int main()
{
int A[N][M],*p, n=0;
int x = 0, y = 0;
p=&(A[x][y]);
printf ("\nenter numbers from 1 to 100\n");
while(x<N)
{
scanf("%d", &(A[x][0]));
if(A[x][0]<1||A[x][0]>100)
puts(" Number is too big/ too small. Try again!");
else
{
seri(A,x,y,n);
x++;
if(x<N) puts ("next number:");
}
}
}
void seri(int A[N][M],int x,int y,int n)
{
for(A[x][0];A[x][y]>1;y++)
{
if (A[x][y]%2==0)
A[x][y+1]= A[x][y]/2;
else
A[x][y+1]=3*A[x][y]+1;
n=y;
printf("\t%d\n", A[x][y]);
}
printf("n = %d. seri is :\n", n);
}
Now I miss
1. the 1 at the end. If I write:
Code:
for(A[x][0];A[x][y]=>1;y++)
I get compiler error:
error C2059: syntax error : '>'
error C2143: syntax error : missing ';' before ')'
error C2181: illegal else without matching if
error C2143: syntax error : missing ')' before 'string'
error C2143: syntax error : missing '{' before 'string'
error C2059: syntax error : '<Unknown>'
error C2059: syntax error : ')'
error C2059: syntax error : '}'
2. the bulk printing at output mentioned above.