Friday, August 16, 2019

WAP for finding a number is even or odd

// C program

#include<stdio.h>
void main()
{
    int n;
    clrscr();
    printf("Enter the number:");
    scanf("%d",&n);
    if ((n%2)==0)
         printf("\n The number is even.");
    else
         printf("\nThe number is odd.");
    getch();
}

Sample Input/Output:

Enter the number:8
The number is even.

No comments:

Post a Comment

Write a program to find gcd of two numbers using recursion.

About:  The process in which a function calls itself is called recursion and the corresponding function is called as recursive function. ...