closed How to make a program to find out odd or even numbers?

+4 votes
asked Jun 19, 2018 by Ashraful Islam Tanzil 2 flags
closed Jun 11 by Admin
Please give me a easy learning script as a example.
closed with the note: Closing question, since it has been answered

36 Answers

0 votes
answered Feb 23 by anonymous
#include <stdio.h>
int main()
{
    int n;
    /* Enter value of n */
    printf("Enter value of n : ");
    scanf("%d",&n);
    
    /* To check wheater n is odd or even */
    
    if(n%2==0)
    printf("%d is Even number",n);
    
    else
    printf("%d is Odd number",n);

    
}
0 votes
answered Feb 26 by Saurabh Tiwari (140 points)
[#include<iostream.h>

int main()

{

int n;

if{ n%2==0;

cout<<"number is even";

}

else{cout<<"number is odd";

}

return 0;

}
0 votes
answered Feb 29 by BHARATH creations (150 points)
#include<stdio.h>

int main()

{

int n;

printf("Enter n value"):

scanf("%d",&n);

if(n%2==0){

printf("Even");

}

else{

printf("Odd");

}

}
0 votes
answered Mar 1 by Hero Panti (150 points)
import java.util.Scanner;
class Main
{
    public static void main(String[] args)
    {
        Scanner input =new Scanner(System.in);
        System.out.print("enter the number = ");
        int n = input.nextInt();
        if(n%2==0)
        {
            System.out.println("N is even no.");
        }
        else
        {
        System.out.println("N is odd no.");
        }
    }
}
0 votes
answered Mar 5 by himaja
a=int(input("ENTER A NUMBER: "))

if(num%2)==0:

    print("even number")

else:

   print("odd number")
0 votes
answered Jun 10 by mahesh (470 points)
#include<stdio.h>
main()
{
    int a;
    printf("enter a number\n");
    scanf("%d",&a);
    if(a%2==0)
    {
        printf("number is even");
        
    }
    else
    {
        printf("number is odd");
    }
}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...