write a program that counts from zero up to a user-specified number. For example, if the user enters the number 5, your program should display the numbers: 0, 1, 2, 3, 4, 5. You cannot use an if-statement for this part!
#include <iostream>
using namespace std;
int main(){
int input;
cout<<"Input the specified number: ";
cin>>input;
for(int i = 0; i <= input;){
cout<<i++<<" ";
}
cout<<endl;
return 0;
}
Comments
Leave a comment