hallo >>>
i am try to write function that do add in C
ex:
1= 1+0 ==>1
2= 2+1+0 ==> 3
3= 3+2+1+0 ==> 6
....
........
..............
and i wrote this function ..that is working with 1 and 2 >> but it is don't work with the 3 ,4 .....??????? why
i am try to write function that do add in C
ex:
1= 1+0 ==>1
2= 2+1+0 ==> 3
3= 3+2+1+0 ==> 6
....
........
..............
and i wrote this function ..that is working with 1 and 2 >> but it is don't work with the 3 ,4 .....??????? why
Code:
int sum(int X)
{
int sum=0;
int j=0;
while (j <= X)
{ sum = sum + X;
j++;
X=X-1;
}
Comment