Answer:
Algorithm:
1.Create a variable N.
2.Read the value of N from user.
3.for i=1 to N.
3.1 Print value of i.
4.end program.
Implementation in C++:
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variable
int N;
cout<<"Enter value of N:";
// read the value of N
cin>>N;
cout<<"Natural number from 1 to "<<N<<" are:";
for(int i=1;i<=N;i++)
{
// print the numbers
cout<<i<<" ";
}
return 0;
}
Output:
Enter value of N:6
Natural number from 1 to 6 are:1 2 3 4 5 6