Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- typedef int bool;
- #define true 0
- #define false 1
- int egyszam(int tomb[], int meret) {
- int i;
- int min = tomb[0];
- bool volt = false;
- for (i = 1; i < meret; i++) {
- if (tomb[i] < min) {
- volt = false;
- min = tomb[i];
- }
- else if (tomb[i] == min) {
- volt = true;
- }
- }
- if (volt == false) {
- return min;
- }
- return -1;
- }
- int main()
- {
- int tomb[5] = { 2, 5, 6, 2, 4 };
- printf("%d\n", egyszam(tomb, 5));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement