Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Semana 5 - Ejercicio 1
- Escriba una función valide un numero entro y positivo.
- */
- #include<iostream>
- using namespace std;
- int validar(float);
- int main()
- {
- float num;
- cout<<validar(num)<<endl;;
- }
- int validar(float n)
- {
- do{
- cout<<"Ingrese un numero entero y positivo: ";
- cin>>n;
- }
- while(int(n)!=n or n<0);
- return n;
- }
Add Comment
Please, Sign In to add comment