BasicKnowledgeCSharp/LessonsAndTasks/Task Home 2 - Введите три числа и выведите их произведение и сумму/Program.cs
Dvurechensky 058c8f2679 1.0
Main
2024-10-05 09:59:53 +03:00

39 lines
1.2 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
/*
* 2. Введите три числа и выведите на экран значение суммы и произведения этих чисел.
*/
namespace Task_Home_2___Введитери_числа_и_выведитех_произведение_и_сумму
{
class Program
{
static void Main(string[] args)
{
//#2
int g1, g2, g3, res_sum, res_multy;
// 1 ошибка - названия переменных g1 g2 g3 на firstValue secondValue thirdValue
Console.WriteLine("Введите число 1: ");
int.TryParse(Console.ReadLine(), out g1);
Console.WriteLine("Введите число 2: ");
int.TryParse(Console.ReadLine(), out g2);
Console.WriteLine("Введите число 3: ");
int.TryParse(Console.ReadLine(), out g3);
res_sum = g1 + g2 + g3;
res_multy = g1 * g2 * g3;
Console.WriteLine("Результат суммы чисел: " + res_sum);
Console.WriteLine("Результат умножения чисел: " + res_multy);
}
}
}