Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   C (https://www.askmehelpdesk.com/forumdisplay.php?f=438)
-   -   Need program answered (https://www.askmehelpdesk.com/showthread.php?t=264433)

  • Sep 27, 2008, 03:50 PM
    lelandcollins27
    need program answered
    int secret(int x)
    {
    int I, j;
    I = 2 * x;
    if (I > 10)
    j=x/2;
    else
    j = x/3;
    return j - 1;
    }
    int another (int a, int b)
    {
    int I, j;
    j = 0;
    for (I = a; I <=b; I++)
    j = j + I;
    return j;
    }


    what is the output of the following segments
    a. x=10
    cout << secret(x) << endl;

    b. x=5; y=8;
    cout << another(x,y) <<endl;

    c. x=10; k=secret(x);
    cout << x << " " << k <<" " << another (x,k) <<endl;

    d. x=5; y=8;
    cout << another(y,x) <<endl;
  • Oct 10, 2008, 11:22 AM
    iFire

    Where would the cout's be..

  • All times are GMT -7. The time now is 07:33 PM.