My issue
Write a program which does the following:
Declare a variable num and store a user defined input from the console in it.
Declare a variable a and initialise it to 0.
Use the while syntax to create a loop, output the following to the console:
Print a in separate lines as long as it is less than num.
Increment a by 1 in each iteration.
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
int a=0;
cin >>a;
// Complete the code
while(a<num){
cout<<a<<endl;
a=a+1;
}
}
Learning course: ATT - C++
Problem Link: User Input Loop in ATT - C++