Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* C programme to check if a integer is even or odd */
- #include<stdio.h>
- int main(void)
- {
- int a;
- printf("enter a number to test whether it is positive or not\n");
- scanf("%d",&a);
- if(a==0)
- {
- printf("zero\n");
- }
- else if(a%2==0)
- {
- printf("even\n");
- }
- else
- {
- printf("odd\n");
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment