int k;
int z;
float x;
int y=13;
void setup() {
pinMode(13,OUTPUT);
pinMode(10,OUTPUT);
}
void loop(){
x=(y-7)/4;
if (x==floor(x))
k=1;
else
k=2;
if (k==1)
digitalWrite(13,HIGH);
else
digitalWrite(10,HIGH);
but when i use it on isis proteus i dont find the right result (for y=13,x=2.5,so x!=floor(x) then k=2, but i found led pin 13 on)
help me please
in my programm, i want to know if the result of a function is an integer or no!
[int k,y
float x;
void setup() {
pinMode(13,OUTPUT);
pinMode(10,OUTPUT);}
void loop(){
x=(y-7)/4;
if (x==floor(x)) k=1;//k=1 so x in an integer
else k=2;//k=2 so x is a float]
the result found every time is x intiger when x=(13-7)/4=1.5 this is a float.
int k,y
float x;
void setup() {
pinMode(13,OUTPUT);
pinMode(10,OUTPUT);}
void loop(){
x=(y-7)/4;
if (x==floor(x)) k=1;//k=1 so x in an integer
else k=2;//k=2 so x is a float