adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Program in C to check a given number is odd or even number using goto statement.

Program in C to check a given number is odd  or even number using goto statement.


#include<conio.h>
#include<stdio.h>
 void main()
  {
      int n;
      char ch;
      start:
           printf("Enter a number :-");
           scanf("%d",&n);
           if(n%2==0)
             printf("%d is even no.",n);
           else
             printf("%d is odd no.",n);
           printf("\nDo you want to exit.");
           fflush(stdin);
           scanf("%c",&ch);
           if(ch=='n'||ch=='N')
            goto start;
    getch();
  }
Output:-



Post a Comment

1 Comments

subham kumar said…
Nice article . you can use & operator for checking even or odd any number reference check even or odd without modulo