Program to check given number is odd number or not

Program to check given number is odd number or not


// Write a program to check given number is odd number or not
// Ex: 4 -> Not Odd, -3 -> Odd
#include
int main(){
    int n,i;
    printf("Enter a integer:");
    scanf("%d",&n); // input from user
    if(n%2==0){ // checking if odd or not
         printf("%d is not odd number",n);      
    }
    else{
         printf("%d is a odd number",n);
    }
    getch();
}

No comments:

Post a Comment