Untitled
using Microsoft.VisualBasic; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace Задание3 { static class Program { static void Main() { try { int num1, num2, s, num3; num1 = Int32.Parse( Interaction.InputBox("Введите первое число: ")); num2 = Int32.Parse( Interaction.InputBox("Введите второе число: ")); s = num1 + num2; String txt = "Сумма ваших чисел равна: " + s; MessageBox.Show(txt); do { num3 = Int32.Parse( Interaction.InputBox("Введите положительное число снова: ")); s += num3; MessageBox.Show("Новая сумма равна: " + s); } while (num3 > 0); } catch { MessageBox.Show("Необходимо ввести число!"); } } } }
Leave a Comment