C Program demonstrates the goto statement

C Program demonstrates the goto statement. goto statement jums the control from one point to another locally(within a function). In this program we perform a division checking for divide by zero by using the goto statement. Read more about C Programming Language .

* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact info@c-program-example.com
* To find more C programs, do visit www.c-program-example.com
* and browse!
* Happy Coding

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

char data[100];
double num1, num2;

printf(" Please enter a number ==> " );
num1 = atof(data);

printf(" Please enter a number ==> " );
num2 = atof(data);

/* Stop a divide by zero with
* the goto statement. */
if ( num2 == 0.0 ) goto end_prog;

printf(" %4.2f divided by %4.2f is %4.2fn", num1, num2, num1/num2);

printf(" Program endedn");


Read more Similar C Programs
Learn C Programming

Number System

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

(c) www.c-program-example.com

Leave a Reply