JavaScript program to determine if three numbers are consecutive
Problem Definition
Make a JavaScript program which will determine three numbers are consecutive.
Code
<script>
var a=4,b=5,c=6;
if(b==(a+1) && c==(b+1)){
document.write(a+","+b+","+c+" are consecutive");
}else{
document.write(a+","+b+","+c+" are not consecutive");
}
</script>
Comments 0