1+2-3-4+5+6-7-8.30 请问用C# 怎么算出来?求代码
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/09 08:34:25
1+2-3-4+5+6-7-8.30 请问用C# 怎么算出来?求代码
1楼不对啊,你那是1-2+3-4+5-6.,
1楼不对啊,你那是1-2+3-4+5-6.,
一楼的,计算结果不正确
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int result = getResult(30);//从1+2-3-4+5+6-7-8.30
Console.WriteLine("1+2-3-4+5+6-7-8.30 = {0}",result);
result = getResult(50);//从1+2-3-4+5+6-7-8.50
Console.WriteLine("1+2-3-4+5+6-7-8.50 = {0}",result);
Console.Read();
}
private static int getResult(int num)
{
int times = 0;//计数,每隔两个就做一次转换
int sign = 1; //符号变换 通过-1 与 1 来改变
int result = 0; //结果
for (int i = 1; i
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int result = getResult(30);//从1+2-3-4+5+6-7-8.30
Console.WriteLine("1+2-3-4+5+6-7-8.30 = {0}",result);
result = getResult(50);//从1+2-3-4+5+6-7-8.50
Console.WriteLine("1+2-3-4+5+6-7-8.50 = {0}",result);
Console.Read();
}
private static int getResult(int num)
{
int times = 0;//计数,每隔两个就做一次转换
int sign = 1; //符号变换 通过-1 与 1 来改变
int result = 0; //结果
for (int i = 1; i
1+2-3-4+5+6-7-8.30 请问用C# 怎么算出来?求代码
C#做的计算器怎么算出来的大数都是科学计数,用什么代码可以实现,
在C#环境下(1-2+3-4+5-6+7-8+9)用递归方法怎么写
用C#编个计算器,那个0键和小数点的代码要怎么写?
求一个用C#制作的简易计算器程序的代码 只需要实现加减乘除
请问负数取模元算题求负数求模的基本方法有道题-1%5 书上的答案是4,请问怎么算出来的
1、2、3、4、5、6、7,这七个数字一共有几种排列方式?怎么算出来的?
如何用C#画出五角星的图形,求代码
请问1/25,2/5,5/7,1,17/26,()与16,18,21,26,33,()怎么算出来的,
1,2,3,3,2,1,1,2,3,4,5,6,7,7,8,8,7,9,10,11怎么用简便方法算出来等于100
三个5和一个1,用加减乘除算出来等于24,请问怎么算啊?
C#求 1!+2!+3!+……..+20!= sum