Use statement inside if else
#include <stdio.h> int main(void) { int i; printf("Enter a number: "); scanf("%d", &i); if( ( i % 2) == 0) printf("Even"); else printf("Odd"); return 0; }