Computer Programming C Laboratory: Arrays C Programs

C Program to accept 5 numbers and print whether the number is even or odd (array)

Entering data into the array - C Programming

C Program to accept 5 numbers and print whether the number is even or odd.

/* Program to print whether the number is odd or even */

#include <stdio.h>

#include <conio.h>

void main()

{

     int a[5],i;   /* Local definitions */

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

     {

          printf("Enter the %d number: ",i+1);

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

     } /* for */

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

     {

          if(a[i]%2==0)

          printf("%d Number is even. \n",a[i]);

          else

          printf("%d Number is odd. \n",a[i]);

     } /* for */

     getch();

} /* main */

INPUT:

Enter the 1 number: 17

Enter the 2 number: 38

Enter the 3 number: 79

Enter the 4 number: 80

Enter the 5 number: 76

OUTPUT:

17 Number is odd

38 Number is even

79 Number is odd

80 Number is even

76 Number is even

EXPLANATION: This program reads 5 integers into an array, then read array values one by one and evaluate whether the number is even or odd number and print them.


Computer Programming C Laboratory: Arrays C Programs : Tag: C Programming : - C Program to accept 5 numbers and print whether the number is even or odd (array)


Computer Programming C Laboratory: Arrays C Programs



Under Subject


Computer Programming C Laboratory

CS25C01 1st Semester EEE, ECE, CSE, CSE(CY), AIDS, IT practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation



Related Subjects


English Essentials I

EN25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


தமிழர் மரபு - Heritage of Tamils

UC25H01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Applied Calculus

MA25C01 Maths 1 M1 - 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Applied Physics I

PH25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Applied Chemistry I

CY25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Makerspace

ME25C04 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Computer Programming C

CS25C01 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Computer Programming Python

CS25C02 1st Semester | 2025 Regulation | 1st Semester 2025 Regulation


Fundamentals of Electrical and Electronics Engineering

EE25C03 1st Semester EEE Depart | 2025 Regulation | 1st Semester 2025 Regulation


Introduction to Mechanical Engineering

ME25C03 1st Semester Mechanical Dept | 2025 Regulation | 1st Semester 2025 Regulation


Introduction to Civil Engineering

CE25C01 1st Semester Civil, Agri Departments | 2025 Regulation | 1st Semester 2025 Regulation


Essentials of Computing

CS25C03 1st Semester - AIDS, CSE, CSE(CY), IT Department | 2025 Regulation | 1st Semester 2025 Regulation


Applied Physics I Laboratory

PH25C01 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation


Applied Chemistry I Laboratory

CY25C01 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation


Computer Programming C Laboratory

CS25C01 1st Semester EEE, ECE, CSE, CSE(CY), AIDS, IT practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation


Computer Programming Python Laboratory

CS25C02 1st Semester practical Laboratory Manual | 2025 Regulation | 1st Semester Laboratory 2025 Regulation


Engineering Drawing

ME25C01 EEE, Mech, Agri, EEE Depts | 2025 Regulation | 2nd Semester 2025 Regulation


Basic Electronics and Electrical Engineering

EE25C04 1st Semester ECE Dept | 2025 Regulation | 1st Semester 2025 Regulation


Essentials of Computing - Laboratory

CS25C03 1st Semester AIDS, CSE, CSE(CY), IT Depts | practical Laboratory Manual | 2025 Regulation | 1st Semester 2025 Regulation