Untitled

 avatar
unknown
c_cpp
19 days ago
808 B
3
Indexable
/*
Scrivere un sottoprogramma che riceve in ingresso due valori interi positivi a e b. Il sottoprogramma restituisce 1 se b compare all’interno di a, 0
altrimenti. Nota: non si faccia alcuna assunzione sulla dimensione massima di a e b.
Esempio:
• per a=129592 e b=959 il sottoprogramma restituisce 1
• per a=129592 e b=291 il sottoprogramma restituisce 0
*/
#include <stdio.h>

int trovaNumero(int a, int b)
{
    int lungB =0;
    int tempB = b;
    
    while(tempB > 0)
    {
        lungB++;
        tempoB/=10;
    }
    
    int lungA =0;
    int tempA = a;
    
    while(tempA > 0)
    {
        lungA++;
        tempoA/=10;
    }
    
    if(lungB > lungA)
    {
        return 0;
    }
    
    
    
}

int main() {
    // Write C code here
    printf("Try programiz.pro");

    return 0;
}
Leave a Comment