Recap - Dynamic Input
Part of the Fundamentals section of Coddy's C# journey — lesson 48 of 69.
Challenge
BeginnerWrite a program that gets a dynamic number of input values.
The first input is a number that represents the number of the input values following it. The next input values are whole numbers.
In the end, print the sum of all the input numbers (Except the first one that we store at count).
For example,
Input:
3
1
5
6Expected output: 12
Explanation: 1 + 5 + 6 = 12, and there are exactly 3 numbers following the first input number (3).
Note: If you are stuck, look at the hint to understand how to get inputs dynamically.
Try it yourself
using System;
public class Program {
public static void Main(string[] args) {
int count = int.Parse(Console.ReadLine());
// Write your code below
}
}All lessons in Fundamentals
4Operators Part 1
Arithmetic OperatorsModulo OperatorIncrement/DecrementPost Increment/DecrementArithmetic Shortcuts5Operators Part 2
Comparison OperatorsLogical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3