I have a maths problem to solve and it consists of two parts, 1) calculating a list of prime numbers which I am storing in an array, 2) using those prime numbers in a recursion formula with some...
Type: Posts; User: ajm218
I have a maths problem to solve and it consists of two parts, 1) calculating a list of prime numbers which I am storing in an array, 2) using those prime numbers in a recursion formula with some...
I want to declare a global array of length p, which will be determined by the main function depending on the particular case. Is this possible? When I process it, the complier says:
variable-size...
Sorry just to give a quick example of some input, so i gave f(10,5)
MainCL{
printf("%d", f(10,5));
}
int f(int a, int b){
MainCL{
printf("%d", f(10,5));
}
int f(int a, int b){
if(b=0){
return a;}
else{
return f(a,(b-1))-f(a/2,(b-1));}
}
Hi all, I have to program a recursion to find the answer to a maths question, the recursion formula I am working with is:
f(a,b) = f(a,b-1) - f(a/g(b),b-1)
where g is an arbitary function that...
I want to divide two integers, s and t and then round down the answer to produce p, is this the correct code and is there a better way to do it?
p=(int)(floor((float)s/(float)t));
when i run the following code, i think I get an overflow problem, why? Any help would be great
/*Inverses.c*/
#include <catam.h>
main()
{
int i,j;
Thanks for the reply, have changed it to this but now when I run it, it will only let me make one input and always returns a value of 0. Does it need a big overhaul?
double f(double dumx,...
Hi all, I get an error message when I run this code, can anyone tell me why? Have printed the error messages at the bottom
main()
{
double x;
double y;
scanf("%f", &x);
Hi all would appreciate some help or general advice on changing the following code so as to stop whenever i>sqrt(n). My problem is that n is a integer input from a user so how do I calculate a sqrt...