Есть ответ 👍

Дано четырехзначное число .определите: входит ли в него цифра 4

233
500
Посмотреть ответы 3

Ответы на вопрос:


c++:

#include

#include

using std: : cin,std: : cout,std: : string;

int main(){

        string st;

        cin > > st;

        for (auto i: st ){

                if (i == '4'){

                        cout < < "yes";

                        return 0;

                }

        }

        cout < < "no";

        return 0;

}


#python

def searh_4(a):

flag=false

for i in (str(a)):

  if int(i)==4:

    flag=true

return flag

//c++

#include

using namespace std;

bool nod(int a) {

int d;

d = a;

while (d! =0 ){

  int f;

  f = d % 10;

  if (f==4) {

  return true;

  }  

d =d/ 10;

}

return false;

}

int main() {

cout < < nod(1234521);

system("pause");

}

 


101000=40 10010=18 в классе 58 человек или 111010

Популярно: Информатика