i have this code and its output is 54. my question is, can someone please explain to me the process of getting this certain output, which is said to be 54. thank you. :)

#include<stdio.h>
#include<conio.h>
int sumS (int n, int m);
void main ()
{
int x=2, y=5;
clrscr();
printf("%d", sumS(x, y));
getch();
}
int sumS (int n, int m)
{
if (n==m)
return n*m;
else
return (n*n) + sumS (n+1, m)
}

Those are not formula ..
U need to understand program flow, how actually program runs and how decisions are made in its way ..
Hope Vinit 'll agree with me ...

Yup ..
Go on checking step by step how the program flows..

See your values are
x=2 and y=5

When main calls sumS
n=2 and m=5
which are not equal
so else block executed
which returns n*n + again call to sumS with 3 and 5
3 and 5 are not equal so (n+1)*(n+1) + again call to sumS with 4 and 5 and so on
Which ends when 5=5 with returning only 5*5

so finally your result will contain

n*n + (n+1)*(n+1) + (n+2)*(n+2) and so on till n=m ...

Yup ..
Go on checking step by step how the program flows..

See your values are
x=2 and y=5

When main calls sumS
n=2 and m=5
which are not equal
so else block executed
which returns n*n + again call to sumS with 3 and 5
3 and 5 are not equal so (n+1)*(n+1) + again call to sumS with 4 and 5 and so on
Which ends when 5=5 with returning only 5*5

so finally your result will contain

n*n + (n+1)*(n+1) + (n+2)*(n+2) and so on till n=m ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...

Hi. so this is actually a continuation from another question of mineHere but i was advised to start a new thread as the original question was already answered.

This is the result of previous question answered :

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...