#include <iostream>#include <math.h>using namespace std;#include <locale.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char** argv) { setlocale(LC_ALL,"rus"); int e, f, g, h, w; cin>>e>>f>>g>>h>>w; float a, b, c, D; a = (e+f/2)/3; b = abs(pow(h,2) - w); c = sqrt(pow(g- h,2) - 3 * sin(e)); D = pow(b,2) - 4 * a * c; cout<<"a = "<<a<<", b = "<<b<<", c = "<<c<<", D = "<<D<<"."; return 0;}
l=list()
num=str(number)
a=str(a)
for item in list(num):
if item==a:
l.append(item)
return len(l)
вывод
>>> equals(123343,4)
1
>>> equals(123343,3)
3
Более короткая версия
def function(number, a):
l=[int(x) for x in str(number)]
return l.count(a)