hzbn.net
当前位置:首页>>关于打印输出1-2+3-4+.....-100的值的资料>>

打印输出1-2+3-4+.....-100的值

#include int main() { int sum=0,i,j=1,temp; for(i=1;i

Private Sub Command1_Click()Dim sum As Doublesum = 0For i = 1 To 100 sum = sum + ((-1) ^ (i + 1)) / iNext iPrint sumEnd Sub

这里说明下,java中想要将分数转化成小数,分子分母必须有一个是double型,计算结果才是double型的 public class T {public static void main(String[] args) {double a = 1.0;// 接收最后结果double sum = 0.0; // 循环 i的值从1-100for (int i...

#include"stdio.h" int main(void) { int n=100; int i; float sum=0; for(i=1;i

c 语言程序。 #include int main(){ int i; double sum=0; for (i=1;i

int sum = 0,k=-1; for(int i = 1; i

Private Sub Form_click() For a = 1 To 100 Step 2 b = a + b Next For c = 2 To 100 Step 2 d = c + d Next s = b - d Print s End Sub 我是初学者,应该是这样吧

#include int main(){ int i,s=0,t=-1; for(i=1;i

using System; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int sum = 1; for (int i = 2; i

C语言 #include stadio.h; void main(){ int i,sum=0; for(i=1;i

网站首页 | 网站地图
All rights reserved Powered by www.hzbn.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com