Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int n = 8;
- int tab[n];
- int x;
- for(int i=0;i<n;i++)
- {
- printf("Podaj liczbe %d \n", i);
- scanf("%d", &x);
- tab[i] = x;
- }
- int max_index = 0;
- int max = tab[0];
- for(int i=1;i<n;i++)
- {
- if(tab[i]>max)
- {
- max_index = i;
- max = tab[i];
- }
- }
- printf("Najwieksza wartosc w tablicy (%d) pod indeksem: %d", max, max_index);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement