extremely easy question

OK Im following your advice and trying to learn C, I have been working in xcode since I have a mac, anyways, I can do some basic things now but one thing I cant figure out is how to get a program to loop repeatedly until i want it to stop.

here is what I am using at the moment to try to make this happen, a simple little formula:

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{
//NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

// insert code here...
#include <stdio.h>
{
{
int x, y, z ;
printf("z=y-x.\n");
printf("please enter a value for x.\n"); //the value for X
scanf("%d", &x);
printf("please enter a value for y.\n"); //the value for y
scanf("%d", &y);
z=y-x;
printf("the value of Z is %d.\n\n\n",z);

}
}
[pool drain];
return 0;
}

I have tried if commands, goto, and for command tryint to loop this code over and over. I would like it to pop up the formula, enter the values and get a result, then have a sentence like "would you like to repeat this formula? hit enter for yes or type end for no" Then it would keep cycling until I typed the word end in. everything I have tried so far hasnt worked, im sure this is easy but im not having any luck.

Thanks,
J

int main (int argc, const char * argv[])

You're in the wrong forum.

And using the wrong language ...

while (1) {  // "loop forever"
   // looping code
   //    :
   //   etc

   printf("Continue ?");
   reply = getc();
   if (reply == 'n' || reply == 'N') {
     break;
   }
} // end while loop

"real C programmers" do it this way

   reply = getc() | 0x20;
   if ( reply == 'n')

probably reply = tolower(getc());
BASIC programmers would convert to uppercase and compare with 'Y'.

Beware details, like what happens to the end-of-line characters.