CS401 Assignment 2 Solution Spring 2017

Questions No 01                                                                               20 marks

An arithmetic progression (AP) or arithmetic sequence is a sequence of numbers such that the difference between the consecutive terms (An-1 & An) is constant “d”.

You are required to write assembly language code that has two different subroutines:

  • Subroutine to generate an Arithmetic Sequence

You will have to write a subroutine named as “A_Sequence”, which will use some local variables “ASeq” & “Ddiff”.

  • Where the “Ddiff” is a data word contains Dh (0xD).
  • The Arithmetic Sequence “ASeq” will start from a decimal number 3.

This subroutine will generate first 10 terms of Arithmetic Sequence (ASeq). So, Arithmetic Sequence (ASeq) will be shown as: 

  • Subroutine to find the Arithmetic Sequence Term.

You will have to write a subroutine named as “N_Term”. In this subroutine, while using the Arithmetic Sequence (ASeq) and (Ddiff) from previous subroutine, you are required to find the value of 23rd term of arithmetic sequence.