Skip to content

Instantly share code, notes, and snippets.

@Michaelkodji
Created October 6, 2020 12:15
Show Gist options
  • Save Michaelkodji/28894b4b90dd21154bebc64459221bc8 to your computer and use it in GitHub Desktop.
Save Michaelkodji/28894b4b90dd21154bebc64459221bc8 to your computer and use it in GitHub Desktop.
sous-tableau constant
#include <iostream>
using namespace std;
int main()
{
int tab[10]={0}, i=0, j=0, nombre=0, k=0;
cout<<"Entrer le nombre d'element que vous voulez mettre dans votre tableau:\n";
cin>>nombre;
cout<<"Entrer les valeurs du tableau;\n";
for(i=0; i<nombre; i++)
{
cin>>tab[i];
}
for(i=0; i<nombre; i++)
{
if(tab[i]==tab[i+1])
{
j++;
if(j>k)
{
k=j;
}
}
else
{
j=0;
}
}
cout<<"Le nombre de chiffre du plus grand sous tableau est: "<< k+1;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment