WAP C++ to 1-2-3-4-5-..................-n
#include <iostream>
using namespace std;
int main()
{
int n=0;
cout<<"enter the limit";
cin>>n;
for(int i=1;i<=n;i++){
cout<<i;
if(i<n)
cout<<"-";
}
return 0;
}
Output:-
enter the limit5
1-2-3-4-5