How to resolve the algorithm A+B step by step in the Harbour programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm A+B step by step in the Harbour programming language

Table of Contents

Problem Statement

A+B   ─── a classic problem in programming contests,   it's given so contestants can gain familiarity with the online judging system being used.

Given two integers,   A and B. Their sum needs to be calculated.

Two integers are written in the input stream, separated by space(s):

The required output is one integer:   the sum of A and B.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm A+B step by step in the Harbour programming language

Source code in the harbour programming language

PROCEDURE Main()
   LOCAL GetList := {}
   LOCAL bValid := { |n| iif(n>-1001, iif(n<1001, .T.,.F.),.F.) }
   LOCAL a := 0 , b := 0
   
   SetColor( "G+/N" )
   CLS
   @ 10, 01 SAY "Enter two integers (range -1000...+1000):" GET a VALID Eval(bValid,a)
   @ Row(), Col() + 1 GET b VALID Eval(bValid,b)
   READ
   @ 12, 01 SAY "Sum of given numbers is " +  hb_ntos(a+b)

   RETURN

  

You may also check:How to resolve the algorithm Random numbers step by step in the Eiffel programming language
You may also check:How to resolve the algorithm Short-circuit evaluation step by step in the MUMPS programming language
You may also check:How to resolve the algorithm Resistor mesh step by step in the Perl programming language
You may also check:How to resolve the algorithm Hello world/Line printer step by step in the UNIX Shell programming language
You may also check:How to resolve the algorithm Higher-order functions step by step in the Factor programming language