gpt4 book ai didi

c# - 从控制台获取 C# 输入但不返回正确的输出

转载 作者:行者123 更新时间:2023-11-30 23:27:28 26 4
gpt4 key购买 nike

<分区>

C# 程序试图从用户那里获取输入并使用这两个数字来查找产品。

using System;

namespace Program
{
class MainClass
{
static int computeProd1(int num1, int num2)
{
return (num1 * num2);
}

public static void Main (string[] args)
{
int first, second;

Console.Write ("enter first number: ");
first = Convert.ToInt32 (Console.ReadLine ());
Console.Write ("enter 2nd number: ");
second = Convert.ToInt32 (Console.ReadLine ());

int product = computeProd1 (first, second);
//Console.WriteLine ("\n First number is: {0}" , first);
//Console.WriteLine ("\n Second number is: {0}" , second);
Console.WriteLine ("\nTheir product is: {0}" , product);
Console.ReadKey ();
}
}
}

无论我输入什么,第一个和第二个数字已经输出一个数字。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com