ok, I've just read through the IF statement tutorials and found that make the basic programs is pretty easy
but, I'm currently stuck on a problem...
"The Program should read an automobile speed (in km/h) and print the message “Speeding” if the speed exceeds 59kmh. The program should then also calculate the appropriate fine, $80 for 1-10kmh above the limit, $150 for 11-30kmh above the limit, $500 for 31kmh or more above the limit."
I have no idea how to seperate the speeds into different categories...I tried doing this...
insertjust to get me started I tried just doing an $80 fine between 60 and 70 but everytime I try to run it I getCode:#include <stdio.h> int main() { int speed; printf( "Enter Speed:" ); scanf( "%d", &speed ); if ( speed < 59 ) { printf( "Not Speeding!\n"); } else if ( speed >=59 ) && ( speed <=69 ){ printf( "Speeding! Fine:$80\n" ) ; } else { printf( "Speeding!\n" ); } return 0; }
error: syntax error before '{' token|
I think it must have something to do with AND ( speed <=69) because before I added it in, it was working