Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int n;
  5. float factn=1,m,sum;
  6. cout<<"enter nn";
  7. cin>>n;
  8. if(n<10&&n>=0){
  9. do{
  10. factn=factn*n;
  11. m=1/factn;
  12. sum=sum+m;
  13. n--;
  14. }while(n>=1);
  15. cout<<sum;
  16. }
  17. else{
  18. cout<<"error!n";
  19. }
  20. return 0;
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement