Untitled
unknown
c_cpp
9 months ago
750 B
6
Indexable
// Online C compiler to run C program online
#include <stdio.h>
int cercaSottoSequenza(FILE *fp)
{
int prec;
int lunghezza_massima = 1;
int num_corrente;
int lung_corrente = 1;
if(fscanf(fp, "%d", &prec) != 1)
{
return 0;
}
while(fscanf(fp, "%d", &num_corrente) == 1)
{
if(num_corrente == prec + 1)
{
lung_corrente++;
if(lung_corrente > lunghezza_massima)
{
lunghezza_massima = lung_corrente;
}
}else{
lung_corrente = 1;
}
prec = num_corrente;
}
return lunghezza_massima;
}
int main(int argc, char *argv[])
{
return 0;
}
Editor is loading...
Leave a Comment