Advertisement
plantbae

Factorial español

May 23rd, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. //Programa que calcula el factorial de un número ingresado por el usuario
  2.  
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int x, y=1, z;
  9. cout << "En este programa usted obtendra el factorial del numero que ingrese" << endl;
  10. cout << "Ingresar el numero" << endl;
  11. cin >> x;
  12.  
  13. for (z=2; z <= x; z++)
  14. {
  15. y= y*z;
  16. }
  17. cout << "El factorial del numero que ingreso es: " << y << endl;
  18. system("pause");
  19. return 0;
  20. }
  21.  
  22. //El programa no tiene tildes para mejora de interfaz al usuario. Así pues, los errores ortográficos son intencionales. Muchas gracias.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement