🔒 Closed Sino po may alam nito

Status
Not open for further replies.

If Else

Eternal Poster
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;
}
 
Status
Not open for further replies.

About this Thread

  • 5
    Replies
  • 451
    Views
  • 3
    Participants
Last reply from:
Arcturus

Trending Topics

Online now

Members online
1,004
Guests online
5,846
Total visitors
6,850

Forum statistics

Threads
2,354,391
Posts
29,383,483
Members
1,079,440
Latest member
Rubykesha
Back
Top