SUM OF SQUARES OF FIRST ‘N’ NUMBERS MICROPROCESSOR AND MICROCONTROLLER LAB MANUAL - Computer Programming

Latest

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

Thursday, October 13, 2011

SUM OF SQUARES OF FIRST ‘N’ NUMBERS MICROPROCESSOR AND MICROCONTROLLER LAB MANUAL


SUM OF SQUARES OF FIRST ‘N’ NUMBERS

Aim: -   To write an assembly language program to find sum of squares of given ‘n’ numbers.

            MOV CL, NUM
            MOV SUM, 00
L1:       MOV AL, CL
            MUL AL
            ADD AL, SUM
            MOV SUM, AL
            LOOP L1
             END

Result: Sum of squares of first ‘n’ natural numbers is obtained.

No comments:

Post a Comment