What's new

Help Sino po may alam nito

Sakurara

Eternal Poster
Established
Joined
Nov 24, 2016
Posts
560
Reaction
103
Points
449
Create a C program that will determine the even numbers below is the sample output.

Enter a number: 4
4 is even number
 
Conditional operator lang po ito ts, magbasa kalang kahit konti lang magegets mo yan.
input % 2 == 0
printf("Even");
else
printf("Odd");
 
Conditional operator lang po ito ts, magbasa kalang kahit konti lang magegets mo yan.
input % 2 == 0
printf("Even");
else
printf("Odd");
#include <stdio.h>
int main() {
int num;
printf("Enter an number: ");
scanf("%d", &num);

(num % 2 == 0) ? printf("%d is even.", num) : printf("%d is odd.", num);
return 0;
}
 

Similar threads

Back
Top