Goto Statement in C

Get Certified in C Programming and Take Your Skills to the Next Level

Program 1

// Goto Statement in C
#include<stdio.h>
#include<conio.h>
int main()
{

    system("cls");
    printf("\nHello");
    goto abc;
    printf("\nIndore");
    printf("\nBhopal");
    abc: printf("\nBye Bye");

    // int h,m,e,c,total,per;
    // system("cls");
    // hindi:printf("\nEnter marks of hindi: ");
    // scanf("%d",&h);
    // if(h<0 || h>100)
    // {
    //     printf("Invalid marks enter again");
    //     goto hindi;
    // }
    // eng: printf("\nEnter marks of english: ");
    // scanf("%d",&e);
    // if(e<0 || e>100)
    // {
    //     printf("\nInvalid marks enter again");
    //     goto eng;
    // }

    // comp: printf("\nEnter marks of computer: ");
    // scanf("%d",&c);
    // if(c<0 || c>100)
    // {
    //     printf("\nInvalid marks enter again");
    //     goto comp;
    // }
    // math: printf("\nEnter marks of maths: ");
    // scanf("%d",&m);
    // if(m<0 || m>100)
    // {
    //     printf("\nInvalid marks enter again");
    //     goto math;
    // }
    // total=h+e+m+c;
    // printf("\n Total Marks is %d",total);
    // per=total/4;
    // printf("\nPercentage is %d%",per);
    // if(per<35)
    // printf("\nFail");
    // else if(per>=35 && per<=45)
    // printf("\nIII Division");
    // else if(per>=45 && per<=60)
    // printf("\nII Division");
    // else
    // printf("\nI Division");

    return 0;
}

 

If you are Happy with DataFlair, do not forget to make us happy with your positive feedback on Google

courses

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *