write a c program to input the number and print the even number

  1. profile image46
    sudeepbanerjeeposted 7 years ago

    write a c   program to input the number and print the even number

  2. simeonvisser profile image84
    simeonvisserposted 7 years ago

    See if you can adapt the given program if I tell you that you can use the following line to check if a number is even:

    if (n % 2 == 0)

    where n is the variable that contains the number. The operator % performs the modulo operation, see http://en.wikipedia.org/wiki/Modulo_operation .

  3. bmthepro profile image61
    bmtheproposted 7 years ago

    main()
    {
    int n;
    printf("Enter the number :");
    scanf("%d",&n);
    if(n%2==0)
    printf("\nThe number is even");
    else
    printf("\nThe number is odd");
    }

 
working