Здесь Вы можете найти ответы на многие вопросы или задать свой вопрос!
Доброго времени суток, если возникнут во ко коду, буду рад на них ответить
#include <iostream>
#include <string>
int main()
{
std::string str;
std::cin >> str;
int counter = 0;
for (const auto& s : str)
if (std::isdigit(s))
++counter;
}
std::cout << "There is(are) " << counter << " digit(s) in the line\n";
system("pause");
return 0;
93₁₀ =1011101₂
93 : 2 = 46 (1)
46 : 2 = 23 (0)
23 : 2 = 11 (1)
11 : 2 = 5 (1)
5 : 2 = 2 (1)
2 : 2 = 1 (0)
1 : 2 = 0 (1)
124₁₀ =1111100₂
124 : 2 = 62 (0)
62 : 2 = 31 (0)
31 : 2 = 15 (1)
15 : 2 = 7 (1)
7 : 2 = 3 (1)
3 : 2 = 1 (1)
# include < stdio.h> int phi(int x){int i,k=0; if(x> 1)k+=phi(x-1)+phi(x-2); if(x< 2)k=x; return k; } int main (void){int x; scanf("%d",& x); printf("%d",phi(x)); return 0; }
Популярные вопросы