Thread: Need Help writing fraction with powers

  1. #1
    Registered User
    Join Date
    Oct 2015
    Posts
    1

    Need Help writing fraction with powers

    This is my first cse project so bear with me.

    I am trying to write (length_one_side^2)/8 so I can find the area.

    What I have

    float length_one_side;
    printf("Enter the length of one side of the garden: (in feet) ");
    scanf("%f", length_one_side);

    float triangular_bed_area;
    printf("length_one_side*length_one_side/8");
    scanf("%f", triangular_bed_area);

    Any help would be much appreciative.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    You write

    float triangular_bed_area = length_one_side * length_one_side / 8;
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Also posted here.

  4. #4
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,834
    Scanf requires address of variable. e.g. scanf("%f", &length_one_side);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. powers
    By domacadin in forum C++ Programming
    Replies: 3
    Last Post: 12-24-2010, 01:51 PM
  2. Powers
    By Gordon in forum Windows Programming
    Replies: 8
    Last Post: 06-18-2008, 05:23 PM
  3. Replies: 18
    Last Post: 03-26-2008, 09:01 AM
  4. The powers (that be)
    By mlmoran in forum C Programming
    Replies: 4
    Last Post: 05-02-2007, 12:49 PM
  5. Help with powers
    By Tim in forum C Programming
    Replies: 3
    Last Post: 05-03-2002, 02:52 AM