I'm new, and I don't know why this does not run successfully.

Sep 16, 2021 at 9:06pm
I am a student and starting to learn C++. Here is the question: The program accepts two positive integers from the input. Output every integer from the first number up to and including the second number. However, you have to precede every integer with the character 1.


Here is code

#include<iostream>

using namespace std;
using std::cin;
using std::cout;

int main()
{
int first, second;
cin>>first>>second;

while(first<=second);
{

cout<<"1"<<first<<",";
first++;
}
}
Sep 16, 2021 at 9:40pm
Remove the semi-colon on the while loop line.
Sep 16, 2021 at 9:45pm
It is solved right now. I do not know how to reply in others chat. But thanks a lot, Ganado.
Sep 16, 2021 at 9:55pm
This chat is ancient, it does not support that, another post is correct.
Topic archived. No new replies allowed.