Skip to main content

printing bigger number goto statement in c

 #include <stdio.h>

int main()

{

    int i,num,a=1,b;

    for(i=0;i<100;i++)

    {

         printf("Enter number:-\nEnter 0 to quit the program:-\n");

         scanf("%d",&num);

         if(a<num)

         a=num;

         else

         printf("Number is less than previous bigger number\n");

        if(num==0)

        {

            goto QUIT;

        }

        printf("The bigger number is %d \n",a);

    }

     QUIT:

    printf("Quitting the program\n");

    printf("BYE BYE !!!!!");

    return 0;

}


Comments

Popular posts from this blog

example of typecasting in c

/*Type Casting in C Typecasting allows us to convert one data type into other. */ //simple example to cast int value into the float. #include <stdio.h>    int   main (){   float   f = ( float ) 9 / 4 ;     printf ( "f : %f \n " ,  f  );     return   0 ;   }