Sebastian876

#2711

Jul 4th, 2021
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3. #2711                          PutereBiti
  4. Se dă un număr n. Afișați rezultatul operației 2 la puterea n .
  5.  
  6. *******************************************************************************/
  7.  
  8. #include <iostream>
  9. #include <fstream>
  10. #include <cmath>
  11.  
  12. using namespace std;
  13.  
  14. ifstream f("numere.txt");
  15. ofstream g("rezultat.txt");
  16.  
  17. int main()
  18. {
  19.    
  20.     int n,r;
  21.    
  22.     f>>n;
  23.    
  24.     r=pow(2,n);
  25.    
  26.   g<<r;
  27.  
  28.   f.close();
  29.   g.close();
  30.    
  31.    return 0;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment