Write a program to list the number of grains of wheat

Assignment Help Computer Engineering
Reference no: EM132192690

Program : King's Reward 

A grateful king told the man who saved the kingdom to choose any reward he wanted. The man asked that he be given one grain of wheat for the first square on a chessboard, 2 grains of wheat the second square, 4 grains for the third square, and so on, doubling each time. The king, who was not a mathematician, agreed.

There are 64 squares on a chessboard. Write a program to list, for each square, the number of grains of wheat on that square Do the program in 2 ways: (1) Use an integer variable for the number of grains (2) Use a double variable for the number of grains.

Then observe your output (which is to be in a file) to find out whether your results are accurate. If they are not accurate, which square is the first bad one (doesn't have the correct number of grains on it Put your observations in a comment in the program source file. Turn in the source file and the output file.

Reference no: EM132192690

Questions Cloud

Identify features that could be implemented : The goal of the group is to identify features that could be implemented into the next few releases of your firm's software.
Knowing locations of users in real time : What types of new applications can emerge from knowing locations of users in real time? What if you also knew what they have in their shopping cart, for example
What is the reasoning behind the given view : It is often said that developing countries have little to gain from economic integration projects among themselves because they trade very little.
What is the expected price of the material per pound : What is the expected price of the material per pound? What is the expected amount of material needed for 100 units?
Write a program to list the number of grains of wheat : Write a program to list, for each square, the number of grains of wheat on that square Do the program in 2 ways.
Average time to read a single sector : Suppose we have a magnetic disk with the following parameters: What is the average time to read a single sector?
At what real interest rate will investment just break even : If an additional unit of capital is invested, it will yield a marginal product equal to 0.06, the mark-up is 20 percent and the depreciation rate is 3 percent.
Popularity ranking techniques such as pagerank : What is the effect of such rings on popularity ranking techniques such as PageRank?
Review problem on endogenous variables : Endogenous variables are explained within the model while exogenous variables are taken as given. The dependency of investment on the growth of demand.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Make perl script in order to display a basic web page

design a Perl script in order to display a basic Web page and display system information that is dynamic using Perl on the screen such as date and time as well as the host and how long system has been up.

  Discuss the different types of tablespaces

Create your own question and provide your own answer that addresses the terms below. Remember your response must be 500 - 600 words.

  Write a function that accepts a variable number of input

Write a function that accepts a variable number of input values and returns the sorted values as an array.

  Calculate the average train and test accuracies

Calculate the average train and test accuracies over the 10 runs, and report them.

  Find one peer-reviewed journal article on leadership style

For this discussion board, find one peer-reviewed journal article on the topic of leadership style. Some sample styles are authentic, servant, authoritative.

  Is there an error in this pseudocode

There is an error in this pseudocode, can you help me find it?

  What is the probability it came from box 3

What is the probability of selecting a 0.01 -mu F capacitor, given that box 2 is selected?

  Creates a object because web pages are considered stateless

Creates a new object because Web pages are considered stateless. They do not retain their values from one trip to the Web server to the next.

  What are the reasons for their growth

Is it a good thing to allow companies other than the manufacturer to extend your browser software.

  What additional research would you wish to do for project

What additional research, if any, would you wish to do for this project in order to select a project management approach suitable for successful completion of the project?

  Design an algorithm to update the minimum spanning tre

Design an algorithm to update the minimum spanning tree when the weight of a single edge e is increased.

  Calculate the round-off error

Suppose a new standard, the IDDD-643 standard, is developed for storing numbers in a string of 16 bits.

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