Answers:
Dear Vidhuantony,
You have to use 2 for loop to generate the numbers between the interval and if-loop to check whether the number generated is binary.
Below is the code:
<font color="#000099">clc;
for i=-10:1:10 //To generate number between 10 and -10
for z=-10:1:10
ans=z+i
if ans ==1 then
printf("\\n The value of f(x,y)=%d, and the answer is binary",ans)
elseif ans==0 then
printf("\\n The value of f(x,y)=%d, and the answer is binary",ans)
else
printf("\\n The value of f(x,y)=%d, and the answer is not binary",ans)
end //end of if loop
end //end of inner for loop
end //end of outer for loop
</font>
Regards,
Lavitha Pereira
Scilab Team
You have to use 2 for loop to generate the numbers between the interval and if-loop to check whether the number generated is binary.
Below is the code:
<font color="#000099">clc;
for i=-10:1:10 //To generate number between 10 and -10
for z=-10:1:10
ans=z+i
if ans ==1 then
printf("\\n The value of f(x,y)=%d, and the answer is binary",ans)
elseif ans==0 then
printf("\\n The value of f(x,y)=%d, and the answer is binary",ans)
else
printf("\\n The value of f(x,y)=%d, and the answer is not binary",ans)
end //end of if loop
end //end of inner for loop
end //end of outer for loop
</font>
Regards,
Lavitha Pereira
Scilab Team
Login to add comment