So I'm currently using Visual Studio 2013, and I was left for homework as a beginner programmer to calculate two summations. First the summation of k to n. k=1 and the equation being k^3.
The parameter would be n and I need to printf the results for n=5, 33, 100, 442, 3456.
I'm honestly not sure how to do this and I need help! I'm completely lost T_T. I know that some of the numbers are big values so float or long should be used but I have no idea how to define these as of yet.
Another is to find the summation
(n)
(k) <<-- one big paranthesis
for values k=8 and n=10, 21, 35, 46, 68
Can anyone give me a lead on these two problems? Or help me out? :(
Any help at all is appreciated! as I have no idea how to start excluding <stdio.h> and int main :(
Also, do I have to repeat a new function for every number for n?
Thank you!
No I'm not asking for someone to do the work. Literlaly I just need help with what functions to use or what to put at the beginning just to give me an idea so I can at least start!
This is what I have so far for something I did differently
// Seung
// Tarea 4
// A01021720
// Factoriales Sumatorias
#include <stdio.h>
int suma1
{
int n = 5; // Defino e Inicializo la variable
long sumatoria = 1; // definición e inicialización del resultado
while (n <= 5)
{
sumatoria = sumatoria + n; //sumatoria = sumatoria + n;
n++; //n = n + 1;
}
return sumatoria;
}
int main()
{
int n = 5;
long sumatoria = 1;
while (n <= 5)
{
sumatoria = sumatoria + n; //sumatoria = sumatoria + n;
n++; //n = n + 1;
}
printf("Sumatoria de k^3: %ld\n", sumatoria);
return 1;
}
The parameter would be n and I need to printf the results for n=5, 33, 100, 442, 3456.
I'm honestly not sure how to do this and I need help! I'm completely lost T_T. I know that some of the numbers are big values so float or long should be used but I have no idea how to define these as of yet.
Another is to find the summation
(n)
(k) <<-- one big paranthesis
for values k=8 and n=10, 21, 35, 46, 68
Can anyone give me a lead on these two problems? Or help me out? :(
Any help at all is appreciated! as I have no idea how to start excluding <stdio.h> and int main :(
Also, do I have to repeat a new function for every number for n?
Thank you!
No I'm not asking for someone to do the work. Literlaly I just need help with what functions to use or what to put at the beginning just to give me an idea so I can at least start!
This is what I have so far for something I did differently
// Seung
// Tarea 4
// A01021720
// Factoriales Sumatorias
#include <stdio.h>
int suma1
{
int n = 5; // Defino e Inicializo la variable
long sumatoria = 1; // definición e inicialización del resultado
while (n <= 5)
{
sumatoria = sumatoria + n; //sumatoria = sumatoria + n;
n++; //n = n + 1;
}
return sumatoria;
}
int main()
{
int n = 5;
long sumatoria = 1;
while (n <= 5)
{
sumatoria = sumatoria + n; //sumatoria = sumatoria + n;
n++; //n = n + 1;
}
printf("Sumatoria de k^3: %ld\n", sumatoria);
return 1;
}