orlandoju

Ejer3_tp3

Apr 6th, 2022
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(void){
  5.  
  6.      int i,n;
  7.     cout<< " Ingrese un numero positivo"<<endl;
  8.     cin>>n;
  9.         cout<<"--------------------"<<endl;
  10.     if(n<1)    {
  11.         cout << "ingreso un numero no positivo, ingrese un numero positivo: "<< endl;
  12.         cin>> n;
  13.         cout<<"--------------------"<<endl;
  14.     }
  15.      for (i = 1; i <=n; i ++){
  16.          cout<<i<<endl;
  17.      }
  18.  
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment