Evaluating a polynomial You are given a polynomial of degree n. The polynomial is of the form
  
  
    P(x) = an · xn + an-1 · xn-1 + … + a0
  
  
  where the ai‘s are the coefficients. Given an integer
  x, write a program that will evaluate P(x). 
  
  You are provided with a function named power( ) that takes two
  positive integers x and y and returns xy. If y is
  0, the function returns 1. 
  
  The prototype of this function is

int power(int x, int y);

  
  INPUT:
  
  
  Line 1 contains the integers n and x separated by whitespace. 
  Line 2 contains the coefficients an, an-1, …, a0 separated by whitespace.
  
  
  OUTPUT: 
  
  A single integer which is P(x).
  
  CONSTRAINTS:
  
  The inputs will satisfy the following properties. It is not necessary
  to validate the inputs.

1 &lt;= n &lt;= 10
1 &lt;= x &lt;= 10
0 &lt;= ai &lt;=10



My code

#include&lt;stdio.h&gt;

int power(int x, int y);

int main()
{

int n,x,a[11],i; unsigned long long int sum=1;
scanf("%d%d",&amp;n,&amp;x);
if(n&lt;1 || n&gt;10) return 0;
if(x&lt;1 || x&gt;10) return 0;



for(i=0;i&lt;=n;i++)
{
scanf("%d",&amp;a[i]);
if(a[i]&lt; 0 || a[i]&gt;10) return 0;
}
for(i=0;i&lt;n;i++)
{

sum+=power(x,n-i)*a[i];
}
printf("%llu",sum);

    return 0;
}



int power(int x, int y)
 {
   int result = x,i;

   if(y == 0) return 1;
   if(x &lt; 0 || y &lt; 0) return 0;

   for(i = 1; i &lt; y; ++i)
   result *= x;

   return result;
}
Recommend a uniform and more indented style.  E.g.

for(i=0;i&lt;n;i++)
{
    sum+=power(x,n-i)*a[i];
}

Both a[11] and if(... n&gt;10) rely on the same value.  Also to avoid undocumented magic numbers, consider the following (also the same for x and a[]):

#define n_MAX (10)
#define n_MIN (0)
int a[n_MAX + 1];
if(n&lt;n_MIN || n&gt;n_MAX) return 0;

unsigned long long int sum serves little value in protecting against numbers larger than INT_MAX as power() is the most likely candidate to overflow.  (Strictly speaking, it is not even known that LLONG_MAX is greater than INT_MAX.)  So if you want a larger range, re-write power() as unsigned long long power(int x, int y), otherwise leaving sum as int is OK.

Else suggest for marginal range improvement:

sum += (unsigned long long) power(x,n-i) * a[i];

BTW: should not it be:

unsigned long long int sum = 0;  //( 0 not 1)

Note: Stated objective says "It is not necessary to validate the inputs.".  Still I like the testing you have done.  Possible that the final reviewer (teacher?) may object to unneeded code.  Could wrap in an #if DEBUG macro...
Faster way to do power()
See no reason for x&lt;0 test in if(x &lt; 0 || y &lt; 0) return 0;.  Could be 

if (y &lt; 0) return 0;

Do power() with unsigned rather than int as " function named power( ) that takes two positive integers x and y".
@Constructor comment leads to an excellent suggestion.  Calculate sum with a loop that does the below.  No need for a power function.  Running sum can be unsigned long long and code gets great range.  Its faster &amp; simple.

// sum = (((a[n]*x + a[n-1])*x + a[n-2])*x + .... )*x + a[0];

// Something like
unsigned long long sum = 0;
for (int i=n; i&gt;=0; i--) {
  sum *= x;
  sum += a[i];
}

Lastly, even the array a is not needed:

#include&lt;stdio.h&gt;
int main() {
  int n;
  unsigned x, a;
  unsigned long long sum = 0;
  scanf("%d%u", &amp;n, &amp;x);
  while (n-- &gt;= 0) {
    scanf("%u", &amp;a);
    sum *= x;
    sum += a;
  }
  printf("%llu", sum);
  return 0;
}