Guys help me please, the equation on 2/3 is giving the waterTemp to 0; how come it is not changing? and also, if the nWaterTemp reached 20.00or somewhere 20.00 to 21.00; it is supposed to print that "THe kettle is now on "Help please
#include<stdio.h>
#include<stdlib.h>
#include<cstdlib>
#include<time.h>
void wait ( int seconds ){
clock_t endwait;
endwait = clock () + seconds * CLOCKS_PER_SEC ;
while (clock() < endwait) {
}
}
void behaviourOn(){
double nWaterTemp = 0;
int counter = 0;
while(nWaterTemp <=100.0){
counter++;
printf("Ticking! %d\n",counter);
wait(1);
if(nWaterTemp >=20.0 && counter%2==0){
nWaterTemp+=0.75;
printf("The water temp is %f\n",nWaterTemp);
}else if(counter%3==0){
nWaterTemp+=2/3;
printf("The water temp is %f\n",nWaterTemp);
}else if(nWaterTemp >=20 && nWaterTemp< 21){
printf("On");
}
}
}
int main(void){
behaviourOn();
system("pause");
}