This is probably a very easy problem, but I am studying while loops and I am trying to write a program that sums numbers from 50 to 100. This is my code that I wrote
#include <iostream>
using namespace std;
int main() {
int sum=0;
int val=1;
while(50 <= val <= 100) {
sum = sum + val;
val = val + 1;
}
cout << "Sum is: " << sum << endl;
return 0;
}
I was to compile the code and get a program, but each time I am trying to run the program on terminal is just goes idle. Is there something wrond with my code? Thanks!