Write a program that computes the sum of all the odd numbers

Assignment Help C/C++ Programming
Reference no: EM13861078

There are four programming questions for you to do. Please submit five.sor.asmfiles. In the settings on SPIM for the first 4 questions, as usual use a bare machine with no exception handler, and also choose "Enable Delayed Loads" and "Enable Delayed Branches". This simulates a more realistic machine with a pipelined architecture.

1. Sum of Odds

Write a program that computes the sum of all the odd numbers between 1 and 99:

1+3+5+7+···+97+99

Do this with one counting loop. The loop just needs to increment the counter by the proper amount on each iteration.

2. Significant Bits

Write a program that loads a word into register $8, and then computes the answer to the following question:How many significant bits are in the number in register $8?

The significant bits in a number are the leftmost 1 and all bits to its right. So the bit pattern:

0000 0000 0010 1001 1000 1101 0111 1101... has 22 significant bits. (For example, to load register $8 with the above pattern, 0x00298D7D, use anorifollowed by a left shift followed by anotherori.)

Do this with one loop. Your program should leave the result in register $5.

3. Allowed Ranges

A temperature in $8 is allowed to be within either of two ranges:20=temp=40and60=temp=80. Write a program that sets a flag (register $3) to 1 if the temperature is in an allowed range and to 0 if the temperature is not in an allowed range.

4. To Lower CaseDeclare a string in the data section:

.data

string: .asciiz "ABCDEFG"

Write a program that converts the string to all lower case characters. Do this by adding 0x20 to each character in the string. (See the ASCII chart to figure out why this works.)

Assume that the data consists only of uppercase alphabetical characters, with no spaces or punctuation.

Reference no: EM13861078

Questions Cloud

Why does tomcats first servlet request take so long : Why does Tomcat's first servlet request take so long? How do I disable port 8080? I want Tomcat to run only through my Web server, not directly through Tomcat.
What should sheila have done to avoid interviews like this : What should Sheila have done to avoid interviews like this one. Explain why Sheila, not Pete, should make the selection decision.
How do i change the option for jvm heap memory in tomcat : How and where do I change the option for JVM heap memory in Tomcat? Where are the servlet source files for JSPs compiled in Tomcat?
Perspectives and approaches of individualisation theorists : Compare and contrast the perspectives and approaches of the individualisation theorists, Anthony Giddens, Zygmunt Bauman, Ulrich Beck and Elisabeth Beck-Gernsheim, with specific reference to their discussions of love, romance and the family.
Write a program that computes the sum of all the odd numbers : Write a program that computes the sum of all the odd numbers between 1 and 99. Write a program that loads a word into register $8.
What do you think about mr mohamed recruiting criteria : Do you agree with the consultant opinion, Why. What do you think about Mr Mohamed recruiting criteria. What do you suggest
Prepare an income statement for bill''s summer business : PREPARE AN INCOME STATEMENT FOR BILL'S SUMMER BUSINESS.
The change management strategy used to execute changes : Internal and external contextual factors which influenced the introduction of strategic changes at BA. An evaluation of the nature of these strategic changes, detailing the actual changes which went ahead at BA. An outline of the change management st..
Elaborate on the impact of communication in a mnc : Illustrate common and unique features of localization vs standardization using a Venn Diagram or similar chart, be sure that the chart or graph shows specific examples.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Compare and contrast the object-oriented approach to design

compare and contrast the object-oriented approach to design and the traditional approach.do you believe that there are

  Write a statement that writes both of their values

Write a statement that writes both of their values to standard output in the format

  Write an lc-3 machine language program

Write an LC-3 machine language program starting at location x3000 which divides the number in memory location x4000 by the number in memory location x4001 and stores the quotient at x5000 and the remainder at x5001.

  Elements that must be included in a loop

What are the three elements that must be included in a loop in order for the loop to successfully perform correctly - What will happen if these statements are not included? Provide examples.

  Design and implement a dynamic doubly linked list

Design and implement a dynamic doubly linked list - Allocate and de-allocate memory at runtime - Analyze a basic set of requirements for a problem

  Simulate a simple microcontroller called the simpletron

Building a microcontroller simulator is a fantastic way to build your understanding of how computers work. Deitel & Deitel have an interesting problem called the Simpletron and the Simple Compiler.

  Describe an example of a base

Describe an example of a base and a derived class that shows base-class functions that are overridden in the derived class. Provide the syntax, showing the class definitions of both classes.

  Write a function that collects integers from the user

Write a function that collects integers from the user until a 0 is encountered and returns them in a list in the order they were input (ML only).

  What information do you need to find the selling price

To make a profit, the prices of the items sold in a furniture store are marked up by 60%. Design an algorithm to find the selling price of an item sold at the furniture store. What information do you need to find the selling price?

  Convert code of python in c

Hello , I have a code in python and I need to convert it in C. If you are an expert contcat with me.

  Assignment in c you will write a program that draws a

assignment in c you will write a program that draws a single level for a rogueshylike computer game. the program will

  Containing all the genes in the dna sequence

As described above plus an integer reference parameter, and return a dynamically-allocated array of strings containing all the genes in the DNA sequence. Each string in the array will contain a unique

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd