0
The for Loop
I have another a little problem about the code. The program you are given takes a positive number N as input. Complete the program to calculate the sum of all numbers from 1 to N inclusive. Sample Input 4 Sample Output 10
6 Respuestas
+ 4
The value of N is to be entered by the user.
https://code.sololearn.com/cPDbpuhAbjSS/?ref=app
+ 3
Sebastian Górski Don't call yourself stupid. It is quite common to overlook things and make silly mistakes. Happens to me as well 😅
+ 2
Sebastian Górski
Noone is stupid. Just need sometimes to understand things. So don't worry and try to understand concepts.
+ 1
I'm so stupid... Thank you so much
0
using System;
namespace SoloLearn
{
class Program
{
static void Main(string[] args)
{
int sum = 0;
for (int N = 1; N <= 100; N++)
{
sum += N;
}
Console.WriteLine(sum);
}
}
}
What I need to do.
In this example, I can only make Test case 1
How to change this line
"for (int N = 1; N <= 100; N++)"
"for (int N = 1; N <= ???; N++)" ?
0
@Sebastian Górski
Even I got stuck at first but after seeing your response I got on track. Thanks, mate.