我想利用的最终值到主程序 [英] I want to utilize the final value to the main program

查看:91
本文介绍了我想利用的最终值到主程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

class Class1
{
    public int userInput(int user_Input)
    {
        int final_Value;
        for ( int = 1; int < = user_Input; i++)
        {
            final_Value = int * user_Input;
        }
        return final_Value;
    }
}



我想利用final_value主程序,但它给出了调试..
和目的这个错误是采取从用户为例说,5和这个循环繁殖像5×4×3×2×1
此值,并为我们提供了输出的输入。我们可以在主程序中使用。
I上午初学者在C#。

i want to utilize the final_value to Main Program but it gives error on debugging.. and purpose for this is to take an input from user for example say 5 and this loop multiply this value like 5 x 4 x 3 x 2 x 1 and gives us the output. which we can utilize in main program. i am beginner in c#.

推荐答案

INT 是一个关键字在C#中,你不能把它作为一个变量名。 ,将其更改为别的东西。

int is a keyword in C# and you cannot use that as a variable name. change it to something else.

for ( var i = 1; i < = user_Input; i++)
{
    final_Value = i * user_Input;
}

这篇关于我想利用的最终值到主程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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