You can use the symbol % to see the remainder of the division problem. eg. document.write(11 % 3 + "") will display the number 2 since 3 goes into 11 three times with a remainder of 2.
So here's some sample code:
function oddEven(num){
if(num % 2 == 0){
return "even"
}
else{
return "odd"
}
}
You can use the following code to print a message containing the sum of even numbers between 1 and 10:
var sum = 0;for (var n=1; n<=10; n++) if (n / 2 Math.floor(n / 2)) sum += n;document.Write("The sum of even numbers from 1 to 10 is " + sum);
In Javascript:
<script type="text/javascript" language="javaScript">
var arr= new Array(1,4,5,6,7,7,8,9,10);
var cnt=arr.length();
for(i=0;i<cnt;i++)
{
if(arr[i]%2 == 0)
alert('even');
else
alert('odd');
}
</script>
Logic to get even and odd number remain same in java.
Write and odd program, and add one to it.
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
Java script
write a program draw circle and ellipse by using oval methods in java
That is called IDE (Integrated Development Environment). That is a standard tool to see the code-behind and the outcome. For JAVA there is netbeans & eclipse which are popular & free.
Write a program that graphically demonstrates the shortest path algorithm
You just can't.
Most likely java script
Java script
yes ,i can add the website link in java program when we write.
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
You can write java script code on any platform be it mac, linux, solaris or windows. All you need is a mac version of notepad, some html page where you insert your java script code and a web browser where you view the html page. All major browsers support java script coding and all you need to do is enable the Java Script support in browsers if it is not enabled already.
Exactly what do you mean by 'C program in Java'
write a java program to display "Welcome Java" and list its execution steps.
\n
Java script
No, Java script is not needed to play poptropica.
depending on the intention of the javascript codes you wish to write. there is much you can do with javascript but the only way to find out what "good Java script codes" are is to explore what you want the Javascript to do on the page.