Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- int main(int argc, char** argv)
- {
- int x,i,max=0,licznik=0,tab[100];
- printf("podaj liczby:");
- for (int i = 0; i < 100; i++)
- {
- scanf("%d",&x);
- tab[i]=x;
- licznik=licznik+1;
- if (max<x)
- {
- max = x;
- }
- if (i > 1)
- {
- if (tab[i]-1 == tab[i-1] && tab[i-1]-1 == tab[i-2])
- {
- break;
- }
- }
- }
- printf("Podanych liczb było %d a najwiekszy element to %d ", licznik, max );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement