#include <stdio.h> int main(){ -int x,n,i,sum=0; -printf("Enter the number of number: "); -scanf("%d",&n); -for(x=0;x<n;x++){ --printf("Enter number %d: ",x+1); --scanf("%d",&i); --if(i%2==0) ---sum+=i; -} -printf("%d\\n",sum); -return 0; }
Problem statement
Given a number N and an array A of N numbers. Determine if the array is lucky or not.
Note: the array is lucky if the frequency (number of occurrences) of the minimum element is odd.
Input
First line contains a number N (2 ≤ N ≤ 1000) the number of elements.
Second line contains N numbers ( - 10^5 ≤ A[i] ≤ 10^5).
Output
Print "Lucky" (without quotes) if the frequency of the minimum element is odd, otherwise print "Unlucky"(without quotes).