How to resolve the algorithm Even or odd step by step in the RATFOR programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Even or odd step by step in the RATFOR programming language

Table of Contents

Problem Statement

Test whether an integer is even or odd. There is more than one way to solve this task:

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Even or odd step by step in the RATFOR programming language

Source code in the ratfor programming language

program evenodd

integer a

write(*,101,ADVANCE="NO")
read(*,102)a

if (mod(a,2) .eq. 0) write(*,103)a
   else   write(*,104)a


101  format("Enter a number: ")
102  format(i7)
103  format(i7," Is Even.")
104  format(i7," Is Odd.")


end

  

You may also check:How to resolve the algorithm Vector step by step in the Processing programming language
You may also check:How to resolve the algorithm Detect division by zero step by step in the Rust programming language
You may also check:How to resolve the algorithm Langton's ant step by step in the R programming language
You may also check:How to resolve the algorithm Loops/For with a specified step step by step in the Avail programming language
You may also check:How to resolve the algorithm Strip control codes and extended characters from a string step by step in the Icon and Unicon programming language