write c program

請問這題應該怎麼寫?

write c program to input 4 sides of a rectangle to find its AREA and PERIMETER.

AREA=(Length*Breadth)

PERIMETER=2(Length+Breadth)

謝謝大大~

3 Answers

Rating
  • 1 decade ago
    Favorite Answer

    你都已經寫出來了,祇差I/O而已

    2006-10-18 17:23:21 補充:

    因為是rectangle 所以只要輸入兩邊, 輸四邊萬一四邊都不同那就不是rectangle

    int GetArea (int nLength, int nBreadth)

    {

    int nArea;

    nArea = nLength * nBreadth;

    return (nArea);

    }

    int GetPerimeter (int nLength, int nBreadth)

    {

    int nPerimeter;

    nPerimeter = 2 * (nLength + nBreadth);

    return (nPerimeter);

    }

    I/O請自己寫!!

  • YEN
    Lv 7
    1 decade ago

    如果長和寬輸入不一樣那就成不了長方形囉!

  • 1 decade ago

    我還是不會寫呀..> <..麻煩了!!謝謝..

Still have questions? Get your answers by asking now.