How to resolve the algorithm A+B step by step in the Erlang programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm A+B step by step in the Erlang 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 Erlang programming language
Source code in the erlang programming language
-module(aplusb).
-export([start/0]).
start() ->
case io:fread("","~d~d") of
eof -> ok;
{ok, [A,B]} ->
io:format("~w~n",[A+B]),
start()
end.
You may also check:How to resolve the algorithm Reverse a string step by step in the Smalltalk programming language
You may also check:How to resolve the algorithm Sorting algorithms/Bead sort step by step in the F# programming language
You may also check:How to resolve the algorithm Caesar cipher step by step in the Jsish programming language
You may also check:How to resolve the algorithm Exponentiation order step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Loops/Infinite step by step in the Malbolge programming language