Find Product ! Hacker Earth
You have been given an array A A of size N N consisting of positive integers. You need to find and print the product of all the number in this array Modulo 10 9 + 7 10 9 + 7 . Input Format : The first line contains a single integer N N denoting the size of the array. The next line contains N N space separated integers denoting the elements of the array Output Format : Print a single integer denoting the product of all the elements of the array Modulo 10 9 + 7 10 9 + 7 . Constraints : 1 ≤ N ≤ 10 3 1 ≤ N ≤ 10 3 1 ≤ A [ i ] ≤ 10 3 Source Code in C: #include <stdio.h> int main() { unsigned N, i, answer = 1; do { scanf("%d", &N); } while(N < 1 && N > 1000); long int a[N]; for(i = 0; i < N ; i++) { do { scanf("%li", &a[i]); } while(a[i] < 1 && a[i] ...
Comments
Post a Comment