Write an algorithm to check whether a number is even or odd
Answers
Answered by
2
Answer:
package evenorodd;
public class EvenorOdd {
public static void main(String[] args) {
int num = Integer.parseInt(args[0]);
if (num%2==1){
System.out.println("This number is odd");
} else {
System.out.println("This number is even");
}
}
}
Explanation:
bro this is using java u can use other languages too
Answered by
4
Answer:
step 1 : Start
Step 2 : Read a number to N
Step 3 : Divide the number by 2 and store the remainder in R.
Step 4 : If R = O Then go to Step 6
Step 5 : Print “N is odd” go to step 7
Step 6 : Print “N is even”
Step 7 : Stop
Similar questions