Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
+1 vote
65.2k views
in Principles of Programming and Problem Solving by (29.6k points)
closed by

Write an algorithm to check whether the given number is even or odd.

2 Answers

+1 vote
by (17.0k points)
selected by
 
Best answer

Algorithm to find whether a given number is odd or even :

  • Even integers can always be divided into two without leaving any remaining pieces. They have a 0, 2, 4, 6, or 8 digit ending. Odd numbers are not equally divided by 2.
  • After division by an integer, the remaining operation, percent, returns the residual. If n is even, n percent 2 == 0 will indeed be true, but if n is odd, it will also be incorrect.

ALGORITHM :

STEP 1: START

STEP 2: Receive data from a user or dynamically assign value.

STEP 3: if num percent 2 == 0. Even Integer should be printed.

STEP 4: Else,  Print an Odd Number 

STEP 5: Print an Odd Number 

STEP 6: END

+2 votes
by (29.8k points)
  • 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

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

...