C++ program to print the natural numbers using for loop
kw.cpp
Output
kodingwindow@kw:~$ g++ kw.cpp
kodingwindow@kw:~$ ./a.out How many numbers you want to print 10 1 2 3 4 5 6 7 8 9 10 kodingwindow@kw:~$
C++ program to print the natural numbers using while loop
kw.cpp
Output
kodingwindow@kw:~$ g++ kw.cpp
kodingwindow@kw:~$ ./a.out How many numbers you want to print 10 1 2 3 4 5 6 7 8 9 10 kodingwindow@kw:~$
What Next?
C++ program to print the addition of N numbers
C++ program to print the floating-point numbers
C++ program to print the square of the numbers
Advertisement