C Programming Articles

Submit Article
Home » Articles » C Programming » BeginnersRSS Feeds

Use of the goto statement

Posted By: Ludwik Fischer     Category: C Programming     Views: 12953

Use of the goto statement.

Code for Use of the goto statement in C Programming

#include  <math.h>                                          
        double x, y;                                           
        int count;                                             
        count = 1;                                             
        printf("Enter FIVE real values in a LINE \n");         
        scanf("%lf", &x);                                      
        if (x < 0)                                             
           printf("Value - %d is negative\n",count);           
           y = sqrt(x);                                        
           printf("%lf\t %lf\n", x, y);                        
        count = count + 1;                                     
        if (count <= 5)                                        
   goto read;                                                  
        printf("\nEnd of computation");                        


   Enter FIVE real values in a LINE                            
   50.70  40  -36  75  11.25                                   
   50.750000        7.123903                                   
   40.000000        6.324555                                   
   Value -3 is negative                                        
   75.000000        8.660254                                   
   11.250000        3.354102                                   
   End of computation   

Didn't find what you were looking for? Find more on Use of the goto statement Or get search suggestion and latest updates.

Ludwik Fischer
Ludwik Fischer author of Use of the goto statement is from Frankfurt, Germany.
View All Articles

Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

No Comment Found, Be the First to post comment!