Created
October 6, 2020 12:15
-
-
Save Michaelkodji/28894b4b90dd21154bebc64459221bc8 to your computer and use it in GitHub Desktop.
sous-tableau constant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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