Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cmath>
- using namespace std;
- bool czyPotega(int tab[], long liczba){
- for(int i=0; i<13; i++){
- if(liczba==tab[i]){
- return 1;
- }
- }
- return 0;
- }
- int main()
- {
- int tab[13];
- for(int i=0; i<13; i++){
- tab[i]=pow(3,i);
- }
- int licznik=0;
- fstream plik;
- long long linia;
- plik.open("liczby.txt");
- while(!plik.eof()){
- plik>>linia;
- if(czyPotega(tab, linia)==true){
- licznik++;
- }
- }
- cout<<licznik;
- plik.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement