因此,任务是创建一半的几何系列 [英] So the task is to create a Geometric series which halves

查看:63
本文介绍了因此,任务是创建一半的几何系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的问题:

编写C代码(使用for循环)来创建和打印一个数组GS,它存储每次减半的几何序列的前10个项:

{1 / 2,1 / 4,1 / 8,1 / 16,...... 1/1024}



我的半解决方案

是从1:10

使用for循环并使用公式1 /(2)^ 2

然后打印数组?

解决方案

所以现在这是我的解决方案:



int Initial = 0



初始=输入('输入初始值:')

scanf(%d,初始);



for i = 1:10 {

y(i)=(Initial)*(0.5);

}

end

This is my question:
Write C code (using a for loop) to create and print an array GS that stores the first 10 terms of the geometric sequence that halves each time:
{1/2, 1/4, 1/8, 1/16, ... 1/1024 }

My Semi-solution
is to use a for loop from 1:10
and use the formula 1/(2)^2
then print the array?

解决方案

so this is my solution now:

int Initial=0

Initial=input('Enter initial value: ')
scanf("%d", Initial);

for i =1:10 {
y(i)=(Initial)*(0.5);
}
end


这篇关于因此,任务是创建一半的几何系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆