How to make a discount with an if function?

Hello,

For my ICT I need to make a 20% discount for prices over £25 so I guessed the best way would be an if statement. I have created a Y or N for if the product is over £25. I tried this; =if(C9="Y",*0.9,*1) and I got an error.

Thanks.

Both comments and pings are currently closed.

3 Responses to “How to make a discount with an if function?”

  1. AnalProgrammer says:

    I am assuming Excel.
    Your if function
    =if(C9="Y",*0.9,*1)

    You need to multiply the numbers by something. You currently have just *0.9 and *1. Where is the field to multiply by? A1*0.9.
    But if the discount is 20% then surely 20% from 100 will leave 80%. That means that your sum should be A1*0.8.

    Have fun.

  2. Zombie Hunter says:

    include "stdafx.h"
    #include <iostream>
    using namespace std;
    int main(int argc, TCHAR* argv[])
    {
    double price;
    cout<<"Enter price: ";
    cin>>price;
    if(price > 25)
    {
    price = price * 0.8
    }
    cout<<"Price: "<<price;
    return 0;
    }

  3. Calvin K says:

    #!/bin/bash

    base_price=25
    discount=0.8
    price="$1"

    if [ -z $1 ]; then
    echo -e "\t\tUSAGE: $(basename $0) price"
    exit
    fi

    echo Price is $(echo "scale=2; if($price>$base_price) $price*$discount else $price;" | bc)

Powered by WordPress | Designed by: free css template | Thanks to hostgator coupon and web hosting reviews