Adsense 728 * 15


Custom Search

Write a Program to Print Odd and Even Numbers of an Array

Logic of a Program

1. Take input from user.

2. Run a loop to check each element of an array. If the remainder of a number is zero by
    the division of 2 then It's a even number else it's a odd number.

    // Check whether the Remainder of a number is zero by division of 2

      print even no.
     } else {
      print odd no.

 Program to Print Odd and Even Numbers of an Array

// Program

#include <stdio.h>

void main()
     // Declare variables. 

     int arr[100],i,n;

     printf("How many elements you want to enter");

     printf("Enter the elements in an array");

     // Taking the input from user

    // Logic of even and odd numbers


         printf("Even number is %d\n",arr[i]);

         printf("odd number is %d\n",arr[i]);

Questions Related to Array

Problem on Linked List

No comments:

Post a Comment