📌  相关文章
📜  c++程序使用while循环以相反的顺序打印从1到10的自然数 - C++代码示例

📅  最后修改于: 2022-03-11 14:44:55.054000             🧑  作者: Mango

代码示例1
#include
using namespace std;

int main()
{
    int number;
    
    cout << "\nPlease Enter Maximum Value to print Natural Numbers =  ";
    cin >> number;
    
    int i = number;
    
    cout << "\nList of Natural Numbers from " << number << " to 1 are\n"; 
    while(i >= 1)
      {
        cout << i <<" ";
        i--;
      }
        
     return 0;
}