Question: I am working on an application that retrieves photos from iOS photo library. When the photo is selected, I want to target a .xib to show an interface where the selected photo can be edited. 

However the build is failing due to this error:

> 
> "Unexpected interface name 'imageEditorView': expected expression"
> 
> 
> 

Here is the code:

```
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:    (NSDictionary *)launchOptions
{
    [self dismissViewControllerAnimated:YES completion:^{
        [self.parentViewController presentViewController:imageEditorView: animated:YES completion:nil];
    }];
}

```

I have all the externals imported correctly in the .h files for both controllers. Any help would be greatly appreciated.

Answer: 
This is what you need

```
int f = 1;
int s = 0;
for (i = 1;i <= n;i++)
{     
    f *= i;
    s += f;
}

```

But i would suggest you look at your own code with a debugger to learn how things are working

Edit:

`for (i=1;i<=n;i++);` is equivalent to `i = n+1`

The block here is useless, you're just setting p to 1;

```
{
 p=1;    
}

```

In the following i is always `n+1` and `p` is always 1, so you are effectively doing `i+i+i...` for n times 

```
for (j=1;j<=i;j++)
{
   s=s+(p*i);
}

```
Here's the main logic behind this program : `Use a recursive function to calculate the factorial of n,and use this within a for loop to calculate the summation for all values between 1 and n`:

```
#include<stdio.h>

int factorial(int);

int main(void)
  {
   int i,n,s;
   printf("Put a number:");
   scanf("%d",&n);
   s=0;

     for(i=1;i<=n;i++)
     {
       s+=factorial(i);
     }
  printf("\n Sum=%d",s);

  }

int factorial(int x)
  {

    if(x==1)
    return 1;    
    return x*factorial(x-1);

  }

```

In your program the following piece of code serves no purpose at all:

```
for (i=1;i<=n;i++);    
    {
     p=1;    
    }

```

Further you don't need so many variables for the job.Using recursion makes it all the more simple and elegant, and if you doing it for an assignment, you can impress your teacher more if you can do it the smarter way.Using `for` loops only for the whole thing will make things messy.