Username77177

Nure-Programming-ControlWork1E1-6

Oct 25th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ControlWork1
  4. {
  5.     public class Firstexercise
  6.     {
  7.         static public void fir_ex()
  8.         {
  9.             //Задание 1
  10.             int i = 0, sum = 0;
  11.  
  12.             while (i < 14)
  13.             {
  14.                 Console.WriteLine("Введите значение (" + (i + 1) + ") :"); // Счёт начинается с 0, поэтому и +1
  15.                 int inp = Convert.ToInt32(Console.ReadLine()); //Конвертируем значения
  16.                 sum += inp;
  17.                 i++; //Инкремент
  18.  
  19.             }
  20.                
  21.             Console.WriteLine("Сумма вашего ряда = " + sum);
  22.  
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment