To print a given number is odd or even. #c

//The Program by Tittu Varghese 



#include<stdio.h>

#include<conio.h>

void main()

{

int x,a;

clrscr();

printf("Enter a number\n");

scanf("%d%",&x);

a = x%2;

if (a==0)

    printf("The given number %d is even.",x);

else

    printf("The given number %d is odd.",x);

getch();
}

Comments

Popular posts from this blog

Algorithm to display "n" natural numbers #c

Algorithm to display the sum of n natural numbers #c

Algorithm for Sum of two numbers