Search:

Type: Posts; User: ajm218

Search: Search took 0.00 seconds.

  1. reply

    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...
  2. How to declare global arrays of unknown length?

    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...
  3. Replies
    5
    Views
    2,823

    Correction to initial Code

    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){
  4. Replies
    5
    Views
    2,823

    My inital try

    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));}
    }
  5. Replies
    5
    Views
    2,823

    Can a function call itself?

    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...
  6. Thread: Casting

    by ajm218
    Replies
    1
    Views
    2,204

    Casting

    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));
  7. Replies
    1
    Views
    1,492

    why do i get a bug?

    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;
  8. Replies
    2
    Views
    931

    Thanks for the reply, have changed it to this but...

    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,...
  9. Replies
    2
    Views
    931

    Why is there a bug?

    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);
  10. Replies
    2
    Views
    5,912

    Comparing Int with double???

    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...
Results 1 to 10 of 10