### CS代写|程序设计作业代写algorithm Programming代考|Natural numbers

statistics-lab™ 为您的留学生涯保驾护航 在代写程序设计algorithm Programming方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写程序设计algorithm Programming代写方面经验极为丰富，各种代写程序设计algorithm Programming相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

## CS代写|程序设计作业代写algorithm Programming代考|Natural numbers

Task Analysis. Natural numbers are those numbers that are obtained through sequential counting. The starting number here for the summation process is 1 , the next number is 2 and so on, until we reach $n$-the number of natural numbers to be summed. The numbers to be added are known as inputs and can be generated by instructing the computer. We assign the value 1 to a variable to simulate the first natural number. We then add the value of the variable to an accumulator. The accumulator must then contain some initial value to make the summation process semantically correct, i.e., meaningful. This initial value must be 0 in this case because we are adding the first number. We can then increase the value of the variable containing the first natural number by 1 . This next number, which is 2 in this case, can then be added to the current value of the accumulator to obtain the sum of first two natural numbers. In this way, we can continue the generation and summation process until we add up all the natural numbers, including $N$, for some given value of $\mathrm{N}$. But we must also keep a count of the numbers that are being added; otherwise we will not be able to decide whether we have added the desired $N$ numbers or not. A variable is used here as a counter. This counter must be initialized to zero first, from which we can increment its value each time by 1 when we add some number to the value of the accumulator.

The algorithm corresponding to Problem $3.6$ is shown below:
Step 1. INPUT “ENTER NUMBER OF TERMS TO ADD” TO N
Step 2. SUM $\leftarrow 0$ [INITIALIZATION]
Step 3. I $\leftarrow 1$ [INITIALIZATION]
Step 4. REPEAT STEPS 5 THROUGH 6 WHILE I <= N.
Step 5. COMPUTE SUM $\leftarrow \mathrm{SUM}+\mathrm{I}$
Step 6. COMPUTE I $\leftarrow \mathrm{I}+1$
Step 7. PRINT “THE SUM IS”, SUM
Step 8. STOP
Problem 3.7. Draw a flowchart to show how to obtain the sum of the first 30 natural numbers.

Task Analysis. This problem is similar to Problem 3.6. The only difference is that the number of natural numbers to be added up is given as a constant (30). We do not need input from the user.

## CS代写|程序设计作业代写algorithm Programming代考|We require the product of the first

Task Analysis. We require the product of the first 10 natural numbers. The natural numbers are defined in the task analysis of Problem $3.6$, so the natural numbers can be generated similarly. To hold the product, we require a location that is initialized with 1 so that we can specify how to obtain the new product by multiplying the current product by the natural number currently in use. This is because only the initial value 1 will keep the content of the location for the product unchanged when the value of the product location is multiplied by $1 .$
The algorithm showing solution to Problem $3.8$ is as follows:
Step 1. PRODUCT $\leftarrow 1, \mathrm{NUM} \leftarrow 1, \mathrm{CNT} \leftarrow 0$
(Initialize the variables required)
Step 2. REPEAT STEPS 3 THROUGH 5 WHILE CNT $<=10$
Step 3. COMPUTE PRODUCT $\leftarrow$ PRODUCT*NUM
Step 4. COMPUTE CNT $\leftarrow \mathrm{CNT}+1$
(Increment the Counter)
Step 5. COMPUTE NUM $\leftarrow \mathrm{NUM}+1$ (The next number is generated)
Step 6. PRINT “THE PRODUCT IS”, PRODUCT
Step 7. STOP
Problem 3.9. Draw a flowchart to find the sum of first 15 even natural numbers.

Task Analysis. We know that the first natural even number is 2 and the next natural even number, i.e., the second even number, can be obtained by adding 2 to the first natural number. The successive natural even numbers can be obtained by adding 2 to the preceding natural even number. These even numbers can be accumulated in a location by adding the generated even number each time to the accumulator, which contains zero.

A count of the numbers added will enable us to check whether first 15 even natural numbers have been added up or not. No input is required from the user during the time of execution.
The algorithm showing the solution of Problem 3.9. is given below:
Step 1. [Initialize the accumulator, counter and variable]
$\mathrm{SUMM} \leftarrow 0, \mathrm{CNT} \leftarrow 0, \mathrm{NUM} \leftarrow 2$
Step 2. REPEAT STEPS 3 THROUGH 5 WHILE CNT $<15$
Step 3. COMPUTE SUMM $\leftarrow \mathrm{SUMM}+\mathrm{NUM}$
Step 4. COMPUTE CNT $\leftarrow \mathrm{CNT}+1$
Step 5. COMPUTE NUM $\leftarrow \mathrm{NUM}+2$
Step 6. PRINT “THE DESIRED SUM IS”, SUMM
Step 7. STOP

## CS代写|程序设计作业代写algorithm Programming代考|The solution of Problem

Problem 3.15. Draw a flowchart to show how to find all even natural numbers that are divisible by 7 in a given range.

Task Analysis. We require two numbers that can serve as boundary values between all the desired numbers to be generated. If a number within the given range is divisible by 7 , then it is printed. As the range may include many numbers, each of the numbers need not be accepted as input from the terminal because it will slow down the whole process. We can generate natural numbers one by one based on the lower range given, and then we test the divisibility by 7 . A number is said to be divisible by 7 if it leaves no remainder when divided by 7 . The input is the numbers forming the lower and the upper ranges between which we test all the numbers, including the numbers forming the ranges. A loop is required to perform the same task of divisibility checking with a newly generated number.

Problem 3.16. Construct a flowchart to find the sum of the squares of the first 9 natural numbers that are divisible by $3 .$

Task Analysis. The problem requires the natural numbers divisible by 3 to obtain their square values and then to accumulate 9 such consecutive square values as the sum of the values.

Our procedure to obtain the sum should encompass generating natural numbers one by one, testing each for divisibility by 3 . If one is found to be divisible, we need to obtain the square of the number to determine the desired sum.

## CS代写|程序设计作业代写algorithm Programming代考|Natural numbers

Step 1. 输入“ENTER NUMBER OF TERMS TO ADD”到 N
Step 2. SUM←0[初始化]

## CS代写|程序设计作业代写algorithm Programming代考|We require the product of the first

Step 1. PRODUCT←1,ñ在米←1,Cñ吨←0
（初始化所需的变量）

（增加计数器）

Step 1. [初始化累加器、计数器和变量]

## 有限元方法代写

tatistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。