
Gavinraath
4 год назад
Где ошибка? C++, Нужно найти кол-во нулей в некотором числе.int main(){int q,s=0;cin >> q;while (q != 0){if ((q % 10)==0){s++;}q = q / 10;}cout<return 0;}
ОТВЕТЫ

Iosif
Oct 24, 2020
#include<bits/stdc++.h>
using namespace std;
int n, kol = 0;
int f(){ int tmp; while(n!=0){tmp=n%10;if(tmp==0){kol++;}n /= 10; } return kol;}
int main(){ cin >> n; cout << f() << endl; return 0;}
using namespace std;
int n, kol = 0;
int f(){ int tmp; while(n!=0){tmp=n%10;if(tmp==0){kol++;}n /= 10; } return kol;}
int main(){ cin >> n; cout << f() << endl; return 0;}
447
Смежные вопросы: