Thursday, April 28, 2016

goto Statment

Image result for goto

Simply goto statement tells the program where to jumps, it can jumps forward or backward.


Example : 

#include <stdio.h>
#include <stdlib.h>

int main()
{
   float x,y;

   evaluate_again:

    printf("\nplease enter x value \n");
    scanf("%f",&x);
    y=(x*x*x)+(3*x*x)+(7.6*x)+12;
    printf("The value of y =%f\n",y);
    printf("Do you want to evaluate again ?(y/n)\n");

   if (getche()=='y') {
   goto evaluate_again;
    }
    return 0;
}





Share this

0 Comment to "goto Statment"

Post a Comment