Solved programming problem

Printing all the odd elements of 1D array.

Source code

#include<stdio.h>

int main()

{

    int array[100];/// declare a 1D Array.

    int i,n;

    printf("
Please Enter The array size:");

    scanf("%d",&n);

    printf("
Please Enter %d Element Of the array: 
",n);

    for(i=0; i<n; i++) ///scan array element

    {

        scanf("%d",&array[i]);

    }

     printf("The Even Element of the array:
");

    for(i=0; i<n; i++)

    {

        if(array[i]%2!=0)///checking if any number is odd or not

        {

           printf("%d 
",array[i]);

        }

    }

    return 0;

}

Output

Please Enter The array size:5

Please Enter 5 Element Of the array:

1 2 9 34 67

The ODD Element of the array:

1

9

67

 

Join the discussion

Add your comment

1 previous comment

Tiegree

[url=https://newfasttadalafil.com/]cialis from usa pharmacy[/url] Ujcmoi Propecia What To Eat Xlsohv <a href=https://newfasttadalafil.com/>Cialis</a> https://newfasttadalafil.com/ - Cialis Use Of Zithromax Ziohfm