SlideShare a Scribd company logo
Find odd or even using conditional operator
PROGRAM:
#include <stdio.h>
void main()
{
int num;
printf("Enter a number to find Even or Odd: n");
scanf("%d",&num); /* taking input from user*/
if (num%2==0) /*checking whether the remainder is zero when
divided by 2*/
printf(" The number %d is Even",num);
else
printf(" The number %d is Odd",num);
return(0);
}
Sample Output: (using GNU GCC Compiler with Code Blocks IDE)
Enter a number to find Even or Odd: 5
The number 5 is Odd

More Related Content

PDF
Introduction to Computer and Programing - Lecture 04
PDF
Odd number
PPTX
C Programming Language Part 7
PPTX
C Programming Language Part 9
PPTX
C Programming Language Part 6
Introduction to Computer and Programing - Lecture 04
Odd number
C Programming Language Part 7
C Programming Language Part 9
C Programming Language Part 6

What's hot (20)

PPTX
C Programming Language Step by Step Part 2
PDF
88 c-programs
PPTX
Simple c program
DOCX
C programming Lab 2
PPTX
C Programming Language Part 8
DOCX
Practical write a c program to reverse a given number
DOCX
Practical write a c program to reverse a given number
PPTX
C Programming Language Part 11
DOC
C lab-programs
PPT
Intro to c programming
PPTX
PDF
1 introducing c language
PPTX
SIMPLE C PROGRAMS - SARASWATHI RAMALINGAM
PPTX
Operators
PPTX
C programming
PDF
First c program
DOC
C program to check leap year
PPTX
C Programming Language Part 4
PPTX
How c program execute in c program
C Programming Language Step by Step Part 2
88 c-programs
Simple c program
C programming Lab 2
C Programming Language Part 8
Practical write a c program to reverse a given number
Practical write a c program to reverse a given number
C Programming Language Part 11
C lab-programs
Intro to c programming
1 introducing c language
SIMPLE C PROGRAMS - SARASWATHI RAMALINGAM
Operators
C programming
First c program
C program to check leap year
C Programming Language Part 4
How c program execute in c program
Ad

More from mohdshanu (8)

DOC
Palindrome number program in c
DOC
Palindrome number program c
DOC
C program to add n numbers
DOC
Shan
DOC
Add digits of number in c
DOC
C program to add two numbers
DOC
Ffffffffffff
DOC
Hello world in C language
Palindrome number program in c
Palindrome number program c
C program to add n numbers
Shan
Add digits of number in c
C program to add two numbers
Ffffffffffff
Hello world in C language
Ad

Recently uploaded (20)

PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Sports Quiz easy sports quiz sports quiz
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Cell Types and Its function , kingdom of life
PPTX
Pharma ospi slides which help in ospi learning
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Complications of Minimal Access Surgery at WLH
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Insiders guide to clinical Medicine.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
Pre independence Education in Inndia.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
Institutional Correction lecture only . . .
PDF
Computing-Curriculum for Schools in Ghana
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Module 4: Burden of Disease Tutorial Slides S2 2025
Sports Quiz easy sports quiz sports quiz
Pharmacology of Heart Failure /Pharmacotherapy of CHF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Supply Chain Operations Speaking Notes -ICLT Program
Cell Types and Its function , kingdom of life
Pharma ospi slides which help in ospi learning
102 student loan defaulters named and shamed – Is someone you know on the list?
Microbial diseases, their pathogenesis and prophylaxis
Complications of Minimal Access Surgery at WLH
human mycosis Human fungal infections are called human mycosis..pptx
Insiders guide to clinical Medicine.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Pre independence Education in Inndia.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
GDM (1) (1).pptx small presentation for students
Institutional Correction lecture only . . .
Computing-Curriculum for Schools in Ghana
O7-L3 Supply Chain Operations - ICLT Program
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...

print even or odd number in c

  • 1. Find odd or even using conditional operator PROGRAM: #include <stdio.h> void main() { int num; printf("Enter a number to find Even or Odd: n"); scanf("%d",&num); /* taking input from user*/ if (num%2==0) /*checking whether the remainder is zero when divided by 2*/ printf(" The number %d is Even",num); else printf(" The number %d is Odd",num); return(0); } Sample Output: (using GNU GCC Compiler with Code Blocks IDE) Enter a number to find Even or Odd: 5 The number 5 is Odd