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.

October 27th, 2013 admin

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.

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

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.

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;

}

#!/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)